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 + cFontBorder + 2; |
61 finalRect.y:= Y + FontBorder; |
61 finalRect.y:= Y + cFontBorder; |
62 finalRect.w:= w + FontBorder * 2 + 4; |
62 finalRect.w:= w + cFontBorder * 2 + 4; |
63 finalRect.h:= h + FontBorder * 2; |
63 finalRect.h:= h + cFontBorder * 2; |
64 clr.r:= Color shr 16; |
64 clr.r:= Color shr 16; |
65 clr.g:= (Color shr 8) and $FF; |
65 clr.g:= (Color shr 8) and $FF; |
66 clr.b:= Color and $FF; |
66 clr.b:= Color and $FF; |
67 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr); |
67 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr); |
68 tmpsurf:= doSurfaceConversion(tmpsurf); |
68 tmpsurf:= doSurfaceConversion(tmpsurf); |
69 SDLTry(tmpsurf <> nil, true); |
69 SDLTry(tmpsurf <> nil, true); |
70 SDL_UpperBlit(tmpsurf, nil, Surface, @finalRect); |
70 SDL_UpperBlit(tmpsurf, nil, Surface, @finalRect); |
71 SDL_FreeSurface(tmpsurf); |
71 SDL_FreeSurface(tmpsurf); |
72 finalRect.x:= X; |
72 finalRect.x:= X; |
73 finalRect.y:= Y; |
73 finalRect.y:= Y; |
74 finalRect.w:= w + FontBorder * 2 + 4; |
74 finalRect.w:= w + cFontBorder * 2 + 4; |
75 finalRect.h:= h + FontBorder * 2; |
75 finalRect.h:= h + cFontBorder * 2; |
76 WriteInRect:= finalRect |
76 WriteInRect:= finalRect |
77 end; |
77 end; |
78 |
78 |
79 procedure MakeCrossHairs; |
79 procedure MakeCrossHairs; |
80 var t: LongInt; |
80 var t: LongInt; |
884 r.w:= w; |
884 r.w:= w; |
885 r.h:= h; |
885 r.h:= h; |
886 DrawRoundRect(@r, cWhiteColor, cNearBlackColor, tmpsurf, true); |
886 DrawRoundRect(@r, cWhiteColor, cNearBlackColor, tmpsurf, true); |
887 |
887 |
888 // render caption |
888 // render caption |
889 r:= WriteInRect(tmpsurf, 36 + FontBorder + 2, ha, $ffffffff, font, caption); |
889 r:= WriteInRect(tmpsurf, 36 + cFontBorder + 2, ha, $ffffffff, font, caption); |
890 // render sub caption |
890 // render sub caption |
891 r:= WriteInRect(tmpsurf, 36 + FontBorder + 2, r.y + r.h, $ffc7c7c7, font, subcaption); |
891 r:= WriteInRect(tmpsurf, 36 + cFontBorder + 2, r.y + r.h, $ffc7c7c7, font, subcaption); |
892 |
892 |
893 // render all description lines |
893 // render all description lines |
894 tmpdesc:= description; |
894 tmpdesc:= description; |
895 while tmpdesc <> '' do |
895 while tmpdesc <> '' do |
896 begin |
896 begin |
897 tmpline:= tmpdesc; |
897 tmpline:= tmpdesc; |
898 SplitByChar(tmpline, tmpdesc, '|'); |
898 SplitByChar(tmpline, tmpdesc, '|'); |
899 r2:= r; |
899 r2:= r; |
900 if tmpline <> '' then |
900 if tmpline <> '' then |
901 begin |
901 begin |
902 r:= WriteInRect(tmpsurf, FontBorder + 2, r.y + r.h, $ff707070, font, tmpline); |
902 r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, $ff707070, font, tmpline); |
903 |
903 |
904 // render highlighted caption (if there is a ':') |
904 // render highlighted caption (if there is a ':') |
905 tmpline2:= ''; |
905 tmpline2:= ''; |
906 SplitByChar(tmpline, tmpline2, ':'); |
906 SplitByChar(tmpline, tmpline2, ':'); |
907 if tmpline2 <> '' then |
907 if tmpline2 <> '' then |
908 WriteInRect(tmpsurf, FontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, tmpline + ':'); |
908 WriteInRect(tmpsurf, cFontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, tmpline + ':'); |
909 end |
909 end |
910 end; |
910 end; |
911 |
911 |
912 if extra <> '' then |
912 if extra <> '' then |
913 r:= WriteInRect(tmpsurf, FontBorder + 2, r.y + r.h, extracolor, font, extra); |
913 r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, extracolor, font, extra); |
914 |
914 |
915 r.x:= FontBorder + 6; |
915 r.x:= cFontBorder + 6; |
916 r.y:= FontBorder + 4; |
916 r.y:= cFontBorder + 4; |
917 r.w:= 32; |
917 r.w:= 32; |
918 r.h:= 32; |
918 r.h:= 32; |
919 SDL_FillRect(tmpsurf, @r, $ffffffff); |
919 SDL_FillRect(tmpsurf, @r, $ffffffff); |
920 SDL_UpperBlit(iconsurf, iconrect, tmpsurf, @r); |
920 SDL_UpperBlit(iconsurf, iconrect, tmpsurf, @r); |
921 |
921 |