From e8a388e32a4563ac9ea0895ca6c7cdf83cf9d3ec Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 28 Oct 2008 18:57:02 +0000 Subject: - glPrint(Pchar) -> glPrint(string) - glPrintLetter removed - font engine handles FT_PIXEL_MODE_MONO as FT_Glyph_To_Bitmap(FT_RENDER_MODE_NORMAL) might return a 1bit/pixel black/white image instead of 8bit/pixel gray shaded one (happened with 16px japanese glyphs of simsun.ttf, latin ones were correct). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1482 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 63 +++++++++++++++++++++++------------- src/screens/UScreenEditConvert.pas | 2 +- src/screens/UScreenOptionsRecord.pas | 4 +-- src/screens/UScreenSing.pas | 33 ++++--------------- src/screens/UScreenSingModi.pas | 2 +- 5 files changed, 51 insertions(+), 53 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index fca65359..7e85c5d4 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -327,39 +327,56 @@ Procedure TScreenCredits.Draw_FunkyText; var S: Integer; X,Y,A: Real; - visibleText: PChar; + visibleText: string; begin SetFontSize(30); + //Init ScrollingText if (CTime = Timings[7]) then begin //Set Position of Text Credits_X := 600; - CurrentScrollStart:=1; - CurrentScrollEnd:=1; + CurrentScrollStart := 1; + CurrentScrollEnd := 1; end; - if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + if (CTime > Timings[7]) and + (CurrentScrollStart < length(Funky_Text)) then begin - X:=0; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - for S := 0 to length(visibleText)-1 do begin - Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); - SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); - A:=0; - if (Credits_X+X < 15) then A:=0; - if (Credits_X+X >=15) then A:=Credits_X+X-15; - if Credits_X+X > 32 then A:=17; - glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); - glPrintLetter(visibleText[S]); - X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + X := 0; + visibleText := Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd); + + for S := 1 to length(visibleText) do + begin + Y := abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X, 538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + + if (Credits_X + X > 32) then + A := 17 + else if (Credits_X + X >= 15) then + A := Credits_X + X - 15 + else + A := 0; + + glColor4f(230/255-40/255+Y*(Credits_X+X)/900, + 200/255-30/255+Y*(Credits_X+X)/1000, + 155/255-20/255+Y*(Credits_X+X)/1100, + A/17); + glPrint(visibleText[S]); + X := X + glTextWidth(visibleText[S]); end; - if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin - Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + + if (Credits_X < 0) and (CurrentScrollStart < length(Funky_Text)) then + begin + Credits_X := Credits_X + glTextWidth(Funky_Text[CurrentScrollStart]); inc(CurrentScrollStart); end; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + + visibleText := Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd); + + if (Credits_X + glTextWidth(visibleText) < 600) and + (CurrentScrollEnd < length(Funky_Text)) then + begin inc(CurrentScrollEnd); end; end; @@ -370,9 +387,9 @@ begin SetFontSize(27); glColor4f(1, 1, 1, 1); for S:=0 to high(CTime_hold) do begin - visibleText:=pchar(inttostr(CTime_hold[S])); + visibleText:=inttostr(CTime_hold[S]); SetFontPos (500, X); - glPrint (Addr(visibleText[0])); + glPrint (visibleText[0]); X:=X+20; end; } @@ -1357,7 +1374,7 @@ begin glColor4f(1, 1, 1, 1); //RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); RuntimeStr:='CTime: '+inttostr(CTime); - glPrint (Addr(RuntimeStr[1])); + glPrint (RuntimeStr[1]); } // make the stars shine diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index 9efa1a92..8de2efe4 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -578,7 +578,7 @@ begin for Pet := 0 to High(ATrack) do begin SetFontPos(11, Y + 10 + Pet*YSkip); SetFontSize(15); - glPrint(pchar(ATrack[Pet].Name)); + glPrint(ATrack[Pet].Name); end; for Pet := 0 to High(ATrack) do diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index 541400fd..5681035f 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -651,7 +651,7 @@ var x1, y1, x2, y2: single; i: integer; ToneBoxWidth: real; - ToneString: PChar; + ToneString: string; ToneStringWidth, ToneStringHeight: real; ToneStringMaxWidth: real; ToneStringCenterXOffset: real; @@ -718,7 +718,7 @@ begin // draw the name of the tone /////// - ToneString := PChar(PreviewChannel[State.ChannelIndex].ToneString); + ToneString := PreviewChannel[State.ChannelIndex].ToneString; ToneStringHeight := ChannelBarsTotalHeight; // initialize font diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 1267bab8..b6384b79 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -550,9 +550,9 @@ begin // set custom options case Ini.LyricsFont of - 0: + 0: // normal fonts begin - Lyrics.FontStyle := 0; + Lyrics.FontStyle := 0; Lyrics.LineColor_en.R := Skin_FontR; Lyrics.LineColor_en.G := Skin_FontG; @@ -564,33 +564,14 @@ begin Lyrics.LineColor_dis.B := 0.4; Lyrics.LineColor_dis.A := 1; - Lyrics.LineColor_act.R := 5 / 256; - Lyrics.LineColor_act.G := 163 / 256; - Lyrics.LineColor_act.B := 210 / 256; + Lyrics.LineColor_act.R := 0.02; + Lyrics.LineColor_act.G := 0.6; + Lyrics.LineColor_act.B := 0.8; Lyrics.LineColor_act.A := 1; end; - 1: - begin - Lyrics.FontStyle := 2; - - Lyrics.LineColor_en.R := 0.75; - Lyrics.LineColor_en.G := 0.75; - Lyrics.LineColor_en.B := 1; - Lyrics.LineColor_en.A := 1; - - Lyrics.LineColor_dis.R := 0.8; - Lyrics.LineColor_dis.G := 0.8; - Lyrics.LineColor_dis.B := 0.8; - Lyrics.LineColor_dis.A := 1; - - Lyrics.LineColor_act.R := 0.5; - Lyrics.LineColor_act.G := 0.5; - Lyrics.LineColor_act.B := 1; - Lyrics.LineColor_act.A := 1; - end; - 2: + 1, 2: // outline fonts (is TScalableOutlineFont) begin - Lyrics.FontStyle := 3; + Lyrics.FontStyle := Ini.LyricsFont + 1; Lyrics.LineColor_en.R := 0.75; Lyrics.LineColor_en.G := 0.75; diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 1002b964..c4d4723f 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -690,7 +690,7 @@ begin // used by Hold_The_Line / TeamDuell SetFontSize(Size * 3); SetFontPos (X, Y); - glPrint (PChar(Language.Translate(String(Text)))); + glPrint (Language.Translate(String(Text))); end; function LoadSound(const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound -- cgit v1.2.3