From 2f768387f3849699320229a5b756db78af1207a2 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 19 Oct 2008 16:24:59 +0000 Subject: The size given to TextGL.SetSize() now expresses the size in pixel (formerly it was 1/3 of the pixel-size). For theme and plugin compatibility the following functions multiply the size with 3: - UScreenSingModi.Print - TTheme.ThemeLoadText - TTheme.ThemeLoadSelectSlide TODO: Convert the themes/plugins and remove the "*3" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1459 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/TextGL.pas | 2 +- src/base/UDraw.pas | 2 +- src/base/ULyrics.pas | 6 +- src/base/USingScores.pas | 196 +++++++++++++++++++++++------------------------ src/base/UThemes.pas | 6 +- 5 files changed, 107 insertions(+), 105 deletions(-) (limited to 'src/base') diff --git a/src/base/TextGL.pas b/src/base/TextGL.pas index 03351adf..ad4c0ee2 100644 --- a/src/base/TextGL.pas +++ b/src/base/TextGL.pas @@ -359,7 +359,7 @@ end; procedure SetFontSize(Size: real); begin - Fonts[ActFont].Tex.H := 30 * (Size/10); + Fonts[ActFont].Tex.H := Size; end; procedure SetFontStyle(Style: integer); diff --git a/src/base/UDraw.pas b/src/base/UDraw.pas index a28543b8..61335a53 100644 --- a/src/base/UDraw.pas +++ b/src/base/UDraw.pas @@ -1222,7 +1222,7 @@ begin //Set Font Propertys SetFontStyle(2); //Font: Outlined1 -if Age < 5 then SetFontSize(Age + 1) else SetFontSize(6); +if Age < 5 then SetFontSize((Age + 1) * 3) else SetFontSize(18); SetFontItalic(False); //Check Font Size diff --git a/src/base/ULyrics.pas b/src/base/ULyrics.pas index ece9f1d4..5c5449b1 100644 --- a/src/base/ULyrics.pas +++ b/src/base/ULyrics.pas @@ -463,7 +463,7 @@ begin // set font size to a reasonable value LyricLine.Height := RequestHeight * 0.9; - SetFontSize(LyricLine.Height/3); + SetFontSize(LyricLine.Height); LyricLine.Width := glTextWidth(PChar(LyricLine.Text)); // change font-size to fit into the lyric bar @@ -474,7 +474,7 @@ begin if (LyricLine.Height < 1) then LyricLine.Height := 1; - SetFontSize(LyricLine.Height/3); + SetFontSize(LyricLine.Height); LyricLine.Width := glTextWidth(PChar(LyricLine.Text)); end; @@ -539,7 +539,7 @@ begin // set font size and style SetFontStyle(FontStyle); ResetFont(); - SetFontSize(Line.Height/3); + SetFontSize(Line.Height); glColor4f(1, 1, 1, 1); // center lyrics diff --git a/src/base/USingScores.pas b/src/base/USingScores.pas index 71ae2651..8e2455e1 100644 --- a/src/base/USingScores.pas +++ b/src/base/USingScores.pas @@ -93,19 +93,19 @@ type RBW: Real; //Width of the Rating Bar RBH: Real; //Height of the Rating Bar - TextX: Real; //X Position of the Score Text - TextY: Real; //Y Position of the Score Text - TextFont: Byte; //Font of the Score Text - TextSize: Byte; //Size of the Score Text - - PUW: Real; //Width of the LineBonus Popup - PUH: Real; //Height of the LineBonus Popup - PUFont: Byte; //Font for the PopUps - PUFontSize: Byte; //FontSize for the PopUps - PUStartX: Real; //X Start Position of the LineBonus Popup - PUStartY: Real; //Y Start Position of the LineBonus Popup - PUTargetX: Real; //X Target Position of the LineBonus Popup - PUTargetY: Real; //Y Target Position of the LineBonus Popup + TextX: Real; //X Position of the Score Text + TextY: Real; //Y Position of the Score Text + TextFont: Byte; //Font of the Score Text + TextSize: integer; //Size of the Score Text + + PUW: Real; //Width of the LineBonus Popup + PUH: Real; //Height of the LineBonus Popup + PUFont: Byte; //Font for the PopUps + PUFontSize: integer; //FontSize for the PopUps + PUStartX: Real; //X Start Position of the LineBonus Popup + PUStartY: Real; //Y Start Position of the LineBonus Popup + PUTargetX: Real; //X Target Position of the LineBonus Popup + PUTargetY: Real; //Y Target Position of the LineBonus Popup end; aScorePosition = array[0..MaxPositions-1] of TScorePosition; @@ -138,17 +138,17 @@ type FirstPopUp: PScorePopUp; LastPopUp: PScorePopUp; - //Procedure Draws a Popup by Pointer - Procedure DrawPopUp(const PopUp: PScorePopUp); + // Draws a Popup by Pointer + procedure DrawPopUp(const PopUp: PScorePopUp); - //Procedure Draws a Score by Playerindex - Procedure DrawScore(const Index: Integer); + // Draws a Score by Playerindex + procedure DrawScore(const Index: Integer); - //Procedure Draws the RatingBar by Playerindex - Procedure DrawRatingBar(const Index: Integer); + // Draws the RatingBar by Playerindex + procedure DrawRatingBar(const Index: Integer); - //Procedure Removes a PopUp w/o destroying the List - Procedure KillPopUp(const last, cur: PScorePopUp); + // Removes a PopUp w/o destroying the List + procedure KillPopUp(const last, cur: PScorePopUp); public Settings: record //Record containing some Displaying Options Phase1Time: Real; //time for Phase 1 to complete (in msecs) @@ -158,7 +158,7 @@ type Phase3Time: Real; //time for Phase 3 to complete (in msecs) //The Fade out and Score adding - PopUpTex: Array [0..8] of TTexture; //Textures for every Popup Rating + PopUpTex: array [0..8] of TTexture; //Textures for every Popup Rating RatingBar_BG_Tex: TTexture; //Rating Bar Texs RatingBar_FG_Tex: TTexture; @@ -171,44 +171,44 @@ type RBVisible: Boolean; //Visibility of all Rating Bars //Propertys for Reading Position and Playercount - Property PositionCount: Byte read oPositionCount; - Property PlayerCount: Byte read oPlayerCount; - Property Players: aScorePlayer read aPlayers; + property PositionCount: Byte read oPositionCount; + property PlayerCount: Byte read oPlayerCount; + property Players: aScorePlayer read aPlayers; //Constructor just sets some standard Settings - Constructor Create; + constructor Create; - //Procedure Adds a Position to Array and Increases Position Count - Procedure AddPosition(const pPosition: PScorePosition); + // Adds a Position to Array and Increases Position Count + procedure AddPosition(const pPosition: PScorePosition); - //Procedure Adds a Player to Array and Increases Player Count - Procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word = 0; const Enabled: Boolean = True; const Visible: Boolean = True); + // Adds a Player to Array and Increases Player Count + procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word = 0; const Enabled: Boolean = True; const Visible: Boolean = True); //Change a Players Visibility, Enable - Procedure ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); - Procedure ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); + procedure ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); + procedure ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); - //Procedure Deletes all Player Information - Procedure ClearPlayers; + // Deletes all Player Information + procedure ClearPlayers; - //Procedure Deletes Positions and Playerinformation - Procedure Clear; + // Deletes Positions and Playerinformation + procedure Clear; - //Procedure Loads some Settings and the Positions from Theme - Procedure LoadfromTheme; + // Loads some Settings and the Positions from Theme + procedure LoadfromTheme; - //Procedure has to be called after Positions and Players have been added, before first call of Draw + // has to be called after Positions and Players have been added, before first call of Draw //It gives every Player a Score Position - Procedure Init; + procedure Init; //Spawns a new Line Bonus PopUp for the Player - Procedure SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); + procedure SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); //Removes all PopUps from Mem - Procedure KillAllPopUps; + procedure KillAllPopUps; - //Procedure Draws Scores and Linebonus PopUps - Procedure Draw; + // Draws Scores and Linebonus PopUps + procedure Draw; end; @@ -220,9 +220,9 @@ uses SDL, UGraphic, TextGL; -//----------- -//Constructor just sets some standard Settings -//----------- +{** + * Sets some standard Settings + *} Constructor TSingScores.Create; begin inherited; @@ -259,9 +259,9 @@ begin Settings.RatingBar_Bar_Tex.TexNum := 0; end; -//----------- -//Procedure Adds a Position to Array and Increases Position Count -//----------- +{** + * Adds a Position to Array and Increases Position Count + *} Procedure TSingScores.AddPosition(const pPosition: PScorePosition); begin if (PositionCount < MaxPositions) then @@ -272,9 +272,9 @@ begin end; end; -//----------- -//Procedure Adds a Player to Array and Increases Player Count -//----------- +{** + * Adds a Player to Array and Increases Player Count + *} Procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word; const Enabled: Boolean; const Visible: Boolean); begin if (PlayerCount < MaxPlayers) then @@ -294,46 +294,46 @@ begin end; end; -//----------- -//Change a Players Visibility -//----------- +{** + * Change a Players Visibility + *} Procedure TSingScores.ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); begin if (Index < MaxPlayers) then aPlayers[Index].Visible := pVisible; end; -//----------- -//Change Player Enabled -//----------- +{** + * Change Player Enabled + *} Procedure TSingScores.ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); begin if (Index < MaxPlayers) then aPlayers[Index].Enabled := pEnabled; end; -//----------- -//Procedure Deletes all Player Information -//----------- -Procedure TSingScores.ClearPlayers; +{** + * Procedure Deletes all Player Information + *} +Procedure TSingScores.ClearPlayers; begin KillAllPopUps; oPlayerCount := 0; end; -//----------- -//Procedure Deletes Positions and Playerinformation -//----------- -Procedure TSingScores.Clear; +{** + * Procedure Deletes Positions and Playerinformation + *} +Procedure TSingScores.Clear; begin KillAllPopUps; oPlayerCount := 0; oPositionCount := 0; end; -//----------- -//Procedure Loads some Settings and the Positions from Theme -//----------- +{** + * Procedure Loads some Settings and the Positions from Theme + *} Procedure TSingScores.LoadfromTheme; var I: Integer; Procedure AddbyStatics(const PC: Byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText); @@ -360,7 +360,7 @@ var I: Integer; nPosition.PUH := nPosition.BGH; nPosition.PUFont := 2; - nPosition.PUFontSize := 6; + nPosition.PUFontSize := 18; nPosition.PUStartX := nPosition.BGX; nPosition.PUStartY := nPosition.TextY + 65; @@ -398,9 +398,9 @@ begin AddByStatics(4, Theme.Sing.StaticP3RScoreBG, Theme.Sing.StaticP3SingBar, Theme.Sing.TextP3RScore); end; -//----------- -//Spawns a new Line Bonus PopUp for the Player -//----------- +{** + * Spawns a new Line Bonus PopUp for the Player + *} Procedure TSingScores.SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); var Cur: PScorePopUp; begin @@ -446,9 +446,9 @@ begin Log.LogError('TSingScores: Try to add PopUp for not existing player'); end; -//----------- -// Removes a PopUp w/o destroying the List -//----------- +{** + * Removes a PopUp w/o destroying the List + *} Procedure TSingScores.KillPopUp(const last, cur: PScorePopUp); begin //Give Player the Last Points that missing till now @@ -488,9 +488,9 @@ begin FreeMem(Cur, SizeOf(TScorePopUp)); end; -//----------- -//Removes all PopUps from Mem -//----------- +{** + * Removes all PopUps from Mem + *} Procedure TSingScores.KillAllPopUps; var Cur: PScorePopUp; @@ -510,10 +510,10 @@ begin LastPopUp := nil; end; -//----------- -//Init - has to be called after Positions and Players have been added, before first call of Draw -//It gives every Player a Score Position -//----------- +{** + * Has to be called after Positions and Players have been added, before first call of Draw + * It gives every Player a Score Position + *} Procedure TSingScores.Init; var PlC: Array [0..1] of Byte; //Playercount First Screen and Second Screen @@ -602,9 +602,9 @@ begin end; end; -//----------- -//Procedure Draws Scores and Linebonus PopUps -//----------- +{** + * Draws Scores and Linebonus PopUps + *} Procedure TSingScores.Draw; var I: Integer; @@ -655,15 +655,15 @@ begin end; //eo Visible end; -//----------- -//Procedure Draws a Popup by Pointer -//----------- +{** + * Draws a Popup by Pointer + *} Procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp); var Progress: Real; CurTime: Cardinal; X, Y, W, H, Alpha: Real; - FontSize: Byte; + FontSize: integer; FontOffset: Real; TimeDiff: Cardinal; PIndex: Byte; @@ -706,7 +706,7 @@ begin Y := Positions[PIndex].PUStartY + (Positions[PIndex].PUH - H)/2; FontSize := Round(Progress * Positions[PIndex].PUFontSize); - FontOffset := H / 2 - FontSize; + FontOffset := (H - FontSize) / 2; Alpha := 1; end @@ -729,7 +729,7 @@ begin Y := Positions[PIndex].PUStartY + PosDiff * sqr(Progress); FontSize := Positions[PIndex].PUFontSize; - FontOffset := H / 2 - FontSize; + FontOffset := (H - FontSize) / 2; Alpha := 1 - 0.3 * Progress; end @@ -776,7 +776,7 @@ begin Y := Positions[PIndex].PUTargetY - PosDiff * (1-Progress); FontSize := Positions[PIndex].PUFontSize; - FontOffset := H / 2 - FontSize; + FontOffset := (H - FontSize) / 2; end else begin @@ -820,7 +820,7 @@ begin TextLen := glTextWidth(PChar(Theme.Sing.LineBonusText[PopUp.Rating])); //Color and Pos - SetFontPos (X + (W - TextLen) / 2, Y + FontOffset{12}); + SetFontPos (X + (W - TextLen) / 2, Y + FontOffset); glColor4f(1, 1, 1, Alpha); //Draw @@ -833,9 +833,9 @@ begin Log.LogError('TSingScores: Try to Draw a not existing PopUp'); end; -//----------- -//Procedure Draws a Score by Playerindex -//----------- +{** + * Draws a Score by Playerindex + *} Procedure TSingScores.DrawScore(const Index: Integer); var Position: PScorePosition; diff --git a/src/base/UThemes.pas b/src/base/UThemes.pas index 745a5d9b..02fdf10a 100644 --- a/src/base/UThemes.pas +++ b/src/base/UThemes.pas @@ -1526,7 +1526,8 @@ begin ThemeText.ColB := ThemeIni.ReadFloat(Name, 'ColB', 0); ThemeText.Font := ThemeIni.ReadInteger(Name, 'Font', 0); - ThemeText.Size := ThemeIni.ReadInteger(Name, 'Size', 0); + // FIXME: FONTSIZE + ThemeText.Size := ThemeIni.ReadInteger(Name, 'Size', 0) * 3; ThemeText.Align := ThemeIni.ReadInteger(Name, 'Align', 0); ThemeText.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); @@ -1739,7 +1740,8 @@ begin ThemeSelectS.Z := ThemeIni.ReadFloat(Name, 'Z', 0); - ThemeSelectS.TextSize := ThemeIni.ReadInteger(Name, 'TextSize', 10); + // FIXME: FONTSIZE + ThemeSelectS.TextSize := ThemeIni.ReadInteger(Name, 'TextSize', 10) * 3; ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0); -- cgit v1.2.3