hedgewars/uCaptions.pas
changeset 10015 4feced261c68
parent 9998 736015b847e3
parent 9127 e350500c4edb
child 10105 8c5fa1d15bd5
equal deleted inserted replaced
10014:56d2f2d5aad8 10015:4feced261c68
    13  *
    13  *
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  *)
    17  *)
    18  
    18 
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uCaptions;
    21 unit uCaptions;
    22 
    22 
    23 interface
    23 interface
    43     Captions: array[TCapGroup] of TCaptionStr;
    43     Captions: array[TCapGroup] of TCaptionStr;
    44 
    44 
    45 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
    45 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
    46 begin
    46 begin
    47     if cOnlyStats then exit;
    47     if cOnlyStats then exit;
       
    48     if Length(s) = 0 then
       
    49         exit;
    48     if Captions[Group].Text <> s then
    50     if Captions[Group].Text <> s then
    49         begin
    51         begin
    50         FreeTexture(Captions[Group].Tex);
    52         FreeTexture(Captions[Group].Tex);
    51         Captions[Group].Tex:= nil
    53         Captions[Group].Tex:= nil
    52         end;
    54         end;
    53     
    55 
    54     if Captions[Group].Tex = nil then
    56     if Captions[Group].Tex = nil then
    55         begin
    57         begin
    56         Captions[Group].Color:= Color;
    58         Captions[Group].Color:= Color;
    57         Captions[Group].Text:= s;
    59         Captions[Group].Text:= s;
    58         Captions[Group].Tex:= RenderStringTex(s, Color, fntBig)
    60         Captions[Group].Tex:= RenderStringTex(s, Color, fntBig)