MCPcopy Create free account
hub / github.com/ZDoom/Raze / Draw

Method Draw

source/core/console/c_notifybuffer.cpp:183–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183void FNotifyBuffer::Draw()
184{
185 if (printNative())
186 {
187 DrawNative();
188 return;
189 }
190
191 bool center = (con_centernotify != 0.f);
192 int color;
193 bool canskip = true;
194
195
196 FFont* font = GetNotifyFont();
197 double nfscale = (generic_ui? 0.7 : NotifyFontScale);
198 double scale = 1 / (nfscale * con_notifyscale);
199
200 double line = Top + font->GetDisplacement() / nfscale;
201 double lineadv = font->GetHeight () / nfscale;
202
203 for (unsigned i = 0; i < Text.Size(); ++ i)
204 {
205 FNotifyText &notify = Text[i];
206
207 if (notify.TimeOut == 0)
208 continue;
209
210 int j = notify.TimeOut - notify.Ticker;
211 if (j > 0)
212 {
213 double alpha = (j < NOTIFYFADETIME) ? 1. * j / NOTIFYFADETIME : 1;
214 if (con_pulsetext)
215 {
216 alpha *= 0.7 + 0.3 * sin(I_msTime() / 100.);
217 }
218
219 if (notify.PrintLevel >= PRINTLEVELS)
220 color = CR_UNTRANSLATED;
221 else
222 color = PrintColors[notify.PrintLevel];
223
224 if (!center)
225 DrawText(twod, font, color, 0, line * NotifyFontScale, notify.Text.GetChars(),
226 DTA_FullscreenScale, FSMode_ScaleToHeight,
227 DTA_VirtualWidthF, 320. * scale,
228 DTA_VirtualHeightF, 200. * scale,
229 DTA_KeepRatio, true,
230 DTA_Alpha, alpha, TAG_DONE);
231 else
232 DrawText(twod, font, color, 160 * scale - font->StringWidth (notify.Text) / 2.,
233 line, notify.Text.GetChars(),
234 DTA_FullscreenScale, FSMode_ScaleToHeight,
235 DTA_VirtualWidthF, 320. * scale,
236 DTA_VirtualHeightF, 200. * scale,
237 DTA_Alpha, alpha, TAG_DONE);
238 line += lineadv;
239 canskip = false;
240 }

Callers

nothing calls this directly

Calls 9

printNativeFunction · 0.85
GetNotifyFontFunction · 0.85
I_msTimeFunction · 0.85
DrawTextFunction · 0.85
GetDisplacementMethod · 0.80
GetHeightMethod · 0.45
SizeMethod · 0.45
GetCharsMethod · 0.45
StringWidthMethod · 0.45

Tested by

no test coverage detected