equal
deleted
inserted
replaced
21 unit uCaptions; |
21 unit uCaptions; |
22 |
22 |
23 interface |
23 interface |
24 uses uTypes; |
24 uses uTypes; |
25 |
25 |
26 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup); |
26 procedure AddCaption(s: ansistring; Color: Longword; Group: TCapGroup); |
27 procedure DrawCaptions; |
27 procedure DrawCaptions; |
28 procedure ReloadCaptions(unload: boolean); |
28 procedure ReloadCaptions(unload: boolean); |
29 |
29 |
30 procedure initModule; |
30 procedure initModule; |
31 procedure freeModule; |
31 procedure freeModule; |
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: ansistring; |
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: ansistring; Color: Longword; Group: TCapGroup); |
46 begin |
46 begin |
47 if cOnlyStats then exit; |
47 if cOnlyStats then exit; |
48 if Length(s) = 0 then |
48 if Length(s) = 0 then |
49 exit; |
49 exit; |
50 if Captions[Group].Text <> s then |
50 if Captions[Group].Text <> s then |
72 var Group: TCapGroup; |
72 var Group: TCapGroup; |
73 begin |
73 begin |
74 for Group:= Low(TCapGroup) to High(TCapGroup) do |
74 for Group:= Low(TCapGroup) to High(TCapGroup) do |
75 if unload then |
75 if unload then |
76 FreeTexture(Captions[Group].Tex) |
76 FreeTexture(Captions[Group].Tex) |
77 else if Captions[Group].Text <> '' then |
77 else if length(Captions[Group].Text) > 0 then |
78 Captions[Group].Tex:= RenderStringTex(Captions[Group].Text, Captions[Group].Color, fntBig) |
78 Captions[Group].Tex:= RenderStringTex(Captions[Group].Text, Captions[Group].Color, fntBig) |
79 end; |
79 end; |
80 |
80 |
81 procedure DrawCaptions; |
81 procedure DrawCaptions; |
82 var |
82 var |
97 inc(offset, Tex^.h + 2); |
97 inc(offset, Tex^.h + 2); |
98 if EndTime <= RealTicks then |
98 if EndTime <= RealTicks then |
99 begin |
99 begin |
100 FreeTexture(Tex); |
100 FreeTexture(Tex); |
101 Tex:= nil; |
101 Tex:= nil; |
102 Text:= ''; |
102 Text:= ansistring(''); |
103 EndTime:= 0 |
103 EndTime:= 0 |
104 end; |
104 end; |
105 end; |
105 end; |
106 end; |
106 end; |
107 |
107 |