hedgewars/uRenderUtils.pas
changeset 11512 bd9a2f1b0080
parent 11342 ed5a6478e710
child 11537 bf86c6cb9341
equal deleted inserted replaced
11511:24bef86e3f3a 11512:bd9a2f1b0080
    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, PChar(s), clr);
    99     tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, PChar(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, 'TTF_RenderUTF8_Blended', true);
   102     if SDLCheck(tmpsurf <> nil, 'TTF_RenderUTF8_Blended', true) then
       
   103         exit;
   103     SDL_UpperBlit(tmpsurf, @textRect, Surface, @finalRect);
   104     SDL_UpperBlit(tmpsurf, @textRect, Surface, @finalRect);
   104     SDL_FreeSurface(tmpsurf);
   105     SDL_FreeSurface(tmpsurf);
   105     finalRect.x:= X;
   106     finalRect.x:= X;
   106     finalRect.y:= Y;
   107     finalRect.y:= Y;
   107     finalRect.w:= w + cFontBorder * 2 + 4;
   108     finalRect.w:= w + cFontBorder * 2 + 4;
   520         begin
   521         begin
   521         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, PChar(substr), cNearBlackColorChannels);
   522         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, PChar(substr), cNearBlackColorChannels);
   522         rect.x:= edgeHeight + 1 + ((i - w) div 2);
   523         rect.x:= edgeHeight + 1 + ((i - w) div 2);
   523         // trying to more evenly position the text, vertically
   524         // trying to more evenly position the text, vertically
   524         rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h;
   525         rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h;
   525         SDLTry(tmpsurf <> nil, 'TTF_Init', true);
   526         if not SDLCheck(tmpsurf <> nil, 'TTF_RenderUTF8_Blended', true) then
   526         SDL_UpperBlit(tmpsurf, nil, finalSurface, @rect);
   527         begin
   527         SDL_FreeSurface(tmpsurf);
   528             SDL_UpperBlit(tmpsurf, nil, finalSurface, @rect);
       
   529             SDL_FreeSurface(tmpsurf);
       
   530         end;
   528         inc(line);
   531         inc(line);
   529         end;
   532         end;
   530 
   533 
   531     RenderSpeechBubbleTex:= Surface2Tex(finalSurface, true);
   534     RenderSpeechBubbleTex:= Surface2Tex(finalSurface, true);
   532 
   535