hedgewars/uStore.pas
changeset 6286 835392304f81
parent 6089 adc69bbb24e5
child 6328 d14adf1c7721
child 6377 3ce19204b14b
equal deleted inserted replaced
6285:2c3a6bece643 6286:835392304f81
    54     tmpsurf: PSDL_Surface;
    54     tmpsurf: PSDL_Surface;
    55     clr: TSDL_Color;
    55     clr: TSDL_Color;
    56     finalRect: TSDL_Rect;
    56     finalRect: TSDL_Rect;
    57 begin
    57 begin
    58 w:= 0; h:= 0; // avoid compiler hints
    58 w:= 0; h:= 0; // avoid compiler hints
    59 TTF_SizeUTF8(Fontz[Font].Handle, Str2PChar(s), w, h);
    59 TTF_SizeUTF8(Fontz[Font].Handle, Str2PChar(s), @w, @h);
    60 finalRect.x:= X + FontBorder + 2;
    60 finalRect.x:= X + FontBorder + 2;
    61 finalRect.y:= Y + FontBorder;
    61 finalRect.y:= Y + FontBorder;
    62 finalRect.w:= w + FontBorder * 2 + 4;
    62 finalRect.w:= w + FontBorder * 2 + 4;
    63 finalRect.h:= h + FontBorder * 2;
    63 finalRect.h:= h + FontBorder * 2;
    64 clr.r:= Color shr 16;
    64 clr.r:= Color shr 16;
   794 i:= 0; j:= 0; // avoid compiler hints
   794 i:= 0; j:= 0; // avoid compiler hints
   795 
   795 
   796 // TODO: Recheck height/position calculation
   796 // TODO: Recheck height/position calculation
   797 
   797 
   798 // get caption's dimensions
   798 // get caption's dimensions
   799 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(caption), i, j);
   799 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(caption), @i, @j);
   800 // width adds 36 px (image + space)
   800 // width adds 36 px (image + space)
   801 w:= i + 36 + wa;
   801 w:= i + 36 + wa;
   802 h:= j + ha;
   802 h:= j + ha;
   803 
   803 
   804 // get sub caption's dimensions
   804 // get sub caption's dimensions
   805 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(subcaption), i, j);
   805 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(subcaption), @i, @j);
   806 // width adds 36 px (image + space)
   806 // width adds 36 px (image + space)
   807 if w < (i + 36 + wa) then w:= i + 36 + wa;
   807 if w < (i + 36 + wa) then w:= i + 36 + wa;
   808 inc(h, j + ha);
   808 inc(h, j + ha);
   809 
   809 
   810 // get description's dimensions
   810 // get description's dimensions
   813     begin
   813     begin
   814     tmpline:= tmpdesc;
   814     tmpline:= tmpdesc;
   815     SplitByChar(tmpline, tmpdesc, '|');
   815     SplitByChar(tmpline, tmpdesc, '|');
   816     if tmpline <> '' then
   816     if tmpline <> '' then
   817         begin
   817         begin
   818         TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(tmpline), i, j);
   818         TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(tmpline), @i, @j);
   819         if w < (i + wa) then w:= i + wa;
   819         if w < (i + wa) then w:= i + wa;
   820         inc(h, j + ha)
   820         inc(h, j + ha)
   821         end
   821         end
   822     end;
   822     end;
   823 
   823 
   824 if extra <> '' then
   824 if extra <> '' then
   825     begin
   825     begin
   826     // get extra label's dimensions
   826     // get extra label's dimensions
   827     TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(extra), i, j);
   827     TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(extra), @i, @j);
   828     if w < (i + wa) then w:= i + wa;
   828     if w < (i + wa) then w:= i + wa;
   829     inc(h, j + ha);
   829     inc(h, j + ha);
   830     end;
   830     end;
   831 
   831 
   832 // add borders space
   832 // add borders space