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/Menu/UDisplay.pas | 289 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 Game/Code/Menu/UDisplay.pas (limited to 'Game/Code/Menu/UDisplay.pas') 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. -- 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/Menu/UDisplay.pas | 209 ++++++++++++++++++-------------------------- 1 file changed, 86 insertions(+), 123 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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); -- 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 ++++++++++++++++++++++++++++---------------- 1 file changed, 73 insertions(+), 41 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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); -- 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/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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; -- 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/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas') 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/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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; -- 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 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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; -- 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/Menu/UDisplay.pas') 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/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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); -- 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/Menu/UDisplay.pas | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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); -- 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/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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; -- 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/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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; -- 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/Menu/UDisplay.pas | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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; -- 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/Menu/UDisplay.pas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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, -- 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/Menu/UDisplay.pas | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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 -- 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/Menu/UDisplay.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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} -- 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/Menu/UDisplay.pas | 929 ++++++++++++++++++++++---------------------- 1 file changed, 469 insertions(+), 460 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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. -- 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/Menu/UDisplay.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'Game/Code/Menu/UDisplay.pas') 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 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/Menu/UDisplay.pas | 90 ++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 41 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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; -- 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/Menu/UDisplay.pas | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Game/Code/Menu/UDisplay.pas') 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, -- 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/Menu/UDisplay.pas | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Game/Code/Menu/UDisplay.pas') 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} -- cgit v1.2.3