hedgewars/uChat.pas
changeset 6379 ef4288298e57
parent 6286 835392304f81
child 6381 5f3412f6809e
equal deleted inserted replaced
6378:b812bfcfeb49 6379:ef4288298e57
    22 
    22 
    23 interface
    23 interface
    24 
    24 
    25 procedure initModule;
    25 procedure initModule;
    26 procedure freeModule;
    26 procedure freeModule;
       
    27 procedure ReloadLines;
    27 
    28 
    28 procedure AddChatString(s: shortstring);
    29 procedure AddChatString(s: shortstring);
    29 procedure DrawChat;
    30 procedure DrawChat;
    30 procedure KeyPressChat(Key: Longword);
    31 procedure KeyPressChat(Key: Longword);
    31 
    32 
    70     FreeTexture(cl.Tex);
    71     FreeTexture(cl.Tex);
    71 
    72 
    72 cl.s:= str;
    73 cl.s:= str;
    73 
    74 
    74 if isInput then
    75 if isInput then
    75 begin
    76     begin
    76     color:= colors[#6];
    77     color:= colors[#6];
    77     str:= UserNick + '> ' + str + '_'
    78     str:= UserNick + '> ' + str + '_'
    78 end
    79     end
    79 else
    80 else
    80 begin
    81     begin
    81     color:= colors[str[1]];
    82     color:= colors[str[1]];
    82     delete(str, 1, 1)
    83     delete(str, 1, 1)
    83 end;
    84     end;
    84 
    85 
    85 font:= CheckCJKFont(str, fnt16);
    86 font:= CheckCJKFont(str, fnt16);
    86 w:= 0; h:= 0; // avoid compiler hints
    87 w:= 0; h:= 0; // avoid compiler hints
    87 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @w, @h);
    88 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @w, @h);
    88 
    89 
    95 
    96 
    96 cl.Time:= RealTicks + 12500;
    97 cl.Time:= RealTicks + 12500;
    97 cl.Tex:= Surface2Tex(resSurface, false);
    98 cl.Tex:= Surface2Tex(resSurface, false);
    98 
    99 
    99 SDL_FreeSurface(resSurface)
   100 SDL_FreeSurface(resSurface)
       
   101 end;
       
   102 
       
   103 // For uStore texture recreation
       
   104 procedure ReloadLines;
       
   105 var i: LongWord;
       
   106 begin
       
   107     SetLine(InputStr, InputStr.s, true);
       
   108     for i:= 0 to MaxStrIndex do SetLine(Strs[i], Strs[i].s, false)
   100 end;
   109 end;
   101 
   110 
   102 procedure AddChatString(s: shortstring);
   111 procedure AddChatString(s: shortstring);
   103 begin
   112 begin
   104 if not ChatReady then
   113 if not ChatReady then
   368     showAll:= false;
   377     showAll:= false;
   369     ChatReady:= false;
   378     ChatReady:= false;
   370     missedCount:= 0;
   379     missedCount:= 0;
   371 
   380 
   372     inputStr.Tex := nil;
   381     inputStr.Tex := nil;
   373     for i:= 0 to MaxStrIndex do
   382     for i:= 0 to MaxStrIndex do Strs[i].Tex := nil;
   374     begin
       
   375         Strs[i].Tex := nil;
       
   376     end;
       
   377 end;
   383 end;
   378 
   384 
   379 procedure freeModule;
   385 procedure freeModule;
   380 var i: ShortInt;
   386 var i: ShortInt;
   381 begin
   387 begin
   382     FreeTexture(InputStr.Tex);
   388     FreeTexture(InputStr.Tex);
   383     for i:= 0 to MaxStrIndex do
   389     for i:= 0 to MaxStrIndex do FreeTexture(Strs[i].Tex);
   384     begin
       
   385         FreeTexture(Strs[i].Tex);
       
   386     end;
       
   387 end;
   390 end;
   388 
   391 
   389 end.
   392 end.