hedgewars/uCaptions.pas
branchwebgl
changeset 8026 4a4f21070479
parent 6999 486db9d26e4b
child 8096 453917e94e55
equal deleted inserted replaced
8023:7de85783b823 8026:4a4f21070479
    28 procedure ReloadCaptions(unload: boolean);
    28 procedure ReloadCaptions(unload: boolean);
    29 
    29 
    30 procedure initModule;
    30 procedure initModule;
    31 procedure freeModule;
    31 procedure freeModule;
    32 
    32 
    33 implementation
       
    34 uses uTextures, uRenderUtils, uVariables, uRender;
       
    35 
    33 
    36 type TCaptionStr = record
    34 type TCaptionStr = record
    37     Tex: PTexture;
    35     Tex: PTexture;
    38     EndTime: LongWord;
    36     EndTime: LongWord;
    39     Text: shortstring;
    37     Text: shortstring;
    40     Color: Longword
    38     Color: Longword
    41     end;
    39     end;
    42 var
    40 var
    43     Captions: array[TCapGroup] of TCaptionStr;
    41     Captions: array[TCapGroup] of TCaptionStr;
    44 
    42 
       
    43 implementation
       
    44 uses uTextures, uRenderUtils, uVariables, uRender;
       
    45 
    45 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
    46 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
    46 begin
    47 begin
       
    48     if Length(s) = 0 then
       
    49         exit;
    47     if Captions[Group].Text <> s then
    50     if Captions[Group].Text <> s then
    48         begin
    51         begin
    49         FreeTexture(Captions[Group].Tex);
    52         FreeTexture(Captions[Group].Tex);
    50         Captions[Group].Tex:= nil
    53         Captions[Group].Tex:= nil
    51         end;
    54         end;