hedgewars/uRenderUtils.pas
branchsdl2transition
changeset 9682 aa2431ed87b2
parent 9080 9b42757d7e71
child 11362 ed5a6478e710
equal deleted inserted replaced
9679:dfaa39674e1e 9682:aa2431ed87b2
    97     clr.g:= (Color shr 8) and $FF;
    97     clr.g:= (Color shr 8) and $FF;
    98     clr.b:= Color and $FF;
    98     clr.b:= Color and $FF;
    99     tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr);
    99     tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr);
   100     finalRect.x:= X + cFontBorder + 2;
   100     finalRect.x:= X + cFontBorder + 2;
   101     finalRect.y:= Y + cFontBorder;
   101     finalRect.y:= Y + cFontBorder;
   102     SDLTry(tmpsurf <> nil, true);
   102     SDLTry(tmpsurf <> nil, 'TTF_RenderUTF8_Blended', true);
   103     SDL_UpperBlit(tmpsurf, @textRect, Surface, @finalRect);
   103     SDL_UpperBlit(tmpsurf, @textRect, Surface, @finalRect);
   104     SDL_FreeSurface(tmpsurf);
   104     SDL_FreeSurface(tmpsurf);
   105     finalRect.x:= X;
   105     finalRect.x:= X;
   106     finalRect.y:= Y;
   106     finalRect.y:= Y;
   107     finalRect.w:= w + cFontBorder * 2 + 4;
   107     finalRect.w:= w + cFontBorder * 2 + 4;
   447                 begin
   447                 begin
   448                 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(substr), cNearBlackColorChannels);
   448                 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(substr), cNearBlackColorChannels);
   449                 rect.x:= edgeHeight + 1 + ((i - w) div 2);
   449                 rect.x:= edgeHeight + 1 + ((i - w) div 2);
   450                 // trying to more evenly position the text, vertically
   450                 // trying to more evenly position the text, vertically
   451                 rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h;
   451                 rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h;
   452                 SDLTry(tmpsurf <> nil, true);
   452                 SDLTry(tmpsurf <> nil, 'TTF_RenderUTF8_Blended', true);
   453                 SDL_UpperBlit(tmpsurf, nil, finalSurface, @rect);
   453                 SDL_UpperBlit(tmpsurf, nil, finalSurface, @rect);
   454                 SDL_FreeSurface(tmpsurf);
   454                 SDL_FreeSurface(tmpsurf);
   455                 inc(line);
   455                 inc(line);
   456                 prevpos:= pos;
   456                 prevpos:= pos;
   457                 end;
   457                 end;