hedgewars/uCaptions.pas
changeset 6580 6155187bf599
parent 6415 af2047bb4f70
child 6685 ef706fccfb0a
equal deleted inserted replaced
6579:fc52f7c22c9b 6580:6155187bf599
    32 
    32 
    33 implementation
    33 implementation
    34 uses uTextures, uRenderUtils, uVariables, uRender;
    34 uses uTextures, uRenderUtils, uVariables, uRender;
    35 
    35 
    36 type TCaptionStr = record
    36 type TCaptionStr = record
    37                    Tex: PTexture;
    37     Tex: PTexture;
    38                    EndTime: LongWord;
    38     EndTime: LongWord;
    39                    Text: shortstring;
    39     Text: shortstring;
    40                    Color: Longword
    40     Color: Longword
    41                    end;
    41     end;
    42 var
    42 var
    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
    67 // For uStore texture recreation
    67 // For uStore texture recreation
    68 procedure ReloadCaptions(unload: boolean);
    68 procedure ReloadCaptions(unload: boolean);
    69 var Group: TCapGroup;
    69 var Group: TCapGroup;
    70 begin
    70 begin
    71 for Group:= Low(TCapGroup) to High(TCapGroup) do
    71 for Group:= Low(TCapGroup) to High(TCapGroup) do
    72     if unload then FreeTexture(Captions[Group].Tex)
    72     if unload then
       
    73         FreeTexture(Captions[Group].Tex)
    73     else if Captions[Group].Text <> '' then
    74     else if Captions[Group].Text <> '' then
    74         Captions[Group].Tex:= RenderStringTex(Captions[Group].Text, Captions[Group].Color, fntBig)
    75         Captions[Group].Tex:= RenderStringTex(Captions[Group].Text, Captions[Group].Color, fntBig)
    75 end;
    76 end;
    76 
    77 
    77 procedure DrawCaptions;
    78 procedure DrawCaptions;