hedgewars/uChat.pas
changeset 2677 83ad68ceef72
parent 2664 949c189ba568
child 2699 249adefa9c1c
equal deleted inserted replaced
2676:03bf7a96400a 2677:83ad68ceef72
    57 
    57 
    58 procedure SetLine(var cl: TChatLine; str: shortstring; isInput: boolean);
    58 procedure SetLine(var cl: TChatLine; str: shortstring; isInput: boolean);
    59 var strSurface, resSurface: PSDL_Surface;
    59 var strSurface, resSurface: PSDL_Surface;
    60 	w, h: LongInt;
    60 	w, h: LongInt;
    61 	color: TSDL_Color;
    61 	color: TSDL_Color;
       
    62     font: THWFont;
    62 begin
    63 begin
    63 if cl.Tex <> nil then
    64 if cl.Tex <> nil then
    64 	FreeTexture(cl.Tex);
    65 	FreeTexture(cl.Tex);
    65 
    66 
    66 
    67 
    79 begin
    80 begin
    80 	color:= colors[str[1]];
    81 	color:= colors[str[1]];
    81 	delete(str, 1, 1)
    82 	delete(str, 1, 1)
    82 end;
    83 end;
    83 
    84 
    84 
    85 font:= CheckCJKFont(str, fnt16);
    85 TTF_SizeUTF8(Fontz[fnt16].Handle, Str2PChar(str), w, h);
    86 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), w, h);
    86 
    87 
    87 resSurface:= SDL_CreateRGBSurface(0, toPowerOf2(w), toPowerOf2(h), 32, RMask, GMask, BMask, AMask);
    88 resSurface:= SDL_CreateRGBSurface(0, toPowerOf2(w), toPowerOf2(h), 32, RMask, GMask, BMask, AMask);
    88 
    89 
    89 strSurface:= TTF_RenderUTF8_Solid(Fontz[fnt16].Handle, Str2PChar(str), color);
    90 strSurface:= TTF_RenderUTF8_Solid(Fontz[font].Handle, Str2PChar(str), color);
    90 cl.Width:= w + 4;
    91 cl.Width:= w + 4;
    91 SDL_UpperBlit(strSurface, nil, resSurface, nil);
    92 SDL_UpperBlit(strSurface, nil, resSurface, nil);
    92 SDL_FreeSurface(strSurface);
    93 SDL_FreeSurface(strSurface);
    93 
    94 
    94 cl.Time:= RealTicks + 12500;
    95 cl.Time:= RealTicks + 12500;