diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-04-19 15:30:51 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-04-19 15:30:51 +0000 |
commit | e7650e739e84b47ce6384767e39115adb5d3211a (patch) | |
tree | 76a9c611f693badaf66087da36cbc3c98c34425f /Game/Code/Menu | |
parent | 2cf9ef0a436dd8f216554bc03d3c2f76ff0268a1 (diff) | |
download | usdx-e7650e739e84b47ce6384767e39115adb5d3211a.tar.gz usdx-e7650e739e84b47ce6384767e39115adb5d3211a.tar.xz usdx-e7650e739e84b47ce6384767e39115adb5d3211a.zip |
Fixed a Bug in PageBreak generation for Text
Added support for /n Tag in Texts
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@117 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Menu')
-rw-r--r-- | Game/Code/Menu/UMenuText.pas | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 4b8ea391..55f84bf8 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -61,6 +61,7 @@ var begin
TextString := Value;
+ //Create Page Breaks if width is given
if (W > 0) then
begin
//Set Font Propertys
@@ -76,7 +77,7 @@ begin I := Pos (' ', Value);
While (I <> 0) do
begin
- if (glTextWidth(PChar(Copy (Value,LastBreak + 1,I))) > W) AND (LastPos <> 1) then
+ if (glTextWidth(PChar(Copy (Value,LastBreak + 1,I - LastBreak))) > W) AND (LastPos <> 1) then
begin
//new Break
SetLength (TextTiles, L+1);
@@ -105,6 +106,39 @@ begin SetLength (TextTiles, L+1);
TextTiles[L] := Copy (Value, LastBreak + 1, Length(Value) - LastBreak);
+ end
+ else
+ begin
+ SetLength (TextTiles, 1);
+ TextTiles[0] := Value;
+ end;
+
+ I := 0;
+ // /n Hack
+ While (I <= High(TextTiles)) do
+ begin
+ LastPos := Pos ('/n', TextTiles[I]);
+ if (LastPos = 0) then //No /n Tags -> Search in next Tile
+ Inc(I)
+ else //Found /n Tag -> Create a Break
+ begin
+ //Add a new Tile and move all Tiles behind actual Tile to the right
+ L := Length(TextTiles);
+ SetLength(TextTiles, L+1);
+ For L := L-1 downto I + 1 do
+ begin
+ TextTiles[L+1] := TextTiles[L];
+ end;
+
+ //Write Text to new Tile
+ TextTiles[I+1] := Trim(Copy(TextTiles[I], LastPos + 2, Length(TextTiles[I]) - LastPos - 1));
+ //Delete Text that now is in new Tile from cur. Tile
+ Delete(TextTiles[I], LastPos, Length(TextTiles[I]) - LastPos + 1);
+ TextTiles[I] := Trim (TextTiles[I]);
+
+ //Goto next Tile because cur. Tile can not have another /n Tag
+ Inc(I)
+ end;
end;
//Set Cursor Visible
@@ -148,7 +182,7 @@ begin end;
end;
- if (W <= 0) then //No Width set Draw as one Long String
+ if (False) then //No Width set Draw as one Long String
begin
if not (SelectBool AND SelectBlink) then
Text2 := Text
|