MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnDraw

Method OnDraw

Descent3/mmItem.cpp:239–294  ·  view source on GitHub ↗

override: behavior when gadget is being drawn.

Source from the content-addressed store, hash-verified

237
238// override: behavior when gadget is being drawn.
239void mmItem::OnDraw() {
240 // if not disabled, do fancy effects.
241 if (m_text) {
242 int i;
243
244 ui_DrawSetFont(MMITEM_FONT);
245 ui_DrawSetTextType(0);
246 ui_SetCharAlpha(255);
247 ui_DrawString(m_colors[0], 0, 0, m_text);
248 ui_DrawSetTextType(UI_TEXTTYPE_SATURATE);
249 ui_SetCharAlpha((uint8_t)m_alpha);
250 for (i = 0; i < m_satcount; i++)
251 ui_DrawString(m_colors[0], 0, 0, m_text);
252 }
253
254 if ((UI_TIME() - m_last_frametime) >= m_process_speed) {
255 // process special fx.
256 switch (m_curfx) {
257 case mmItemFXNull:
258 break;
259 case mmItemFXNormal:
260 m_alpha = MMITEM_ALPHA;
261 m_satcount = MMITEM_SAT;
262 m_process_speed = 0.0f;
263 m_curfx = mmItemFXNull;
264 break;
265
266 case mmItemFXFadeOutToNormal:
267 m_process_speed = 0.075f;
268 m_satcount = (m_satcount < MMITEM_SAT) ? MMITEM_SAT : (m_satcount - 1);
269 if (m_satcount == MMITEM_SAT) {
270 m_curfx = mmItemFXNull;
271 }
272 break;
273
274 case mmItemFXFadeInToBright:
275 m_process_speed = 0.075f;
276 m_satcount = (m_satcount > 2) ? 2 : (m_satcount + 1);
277 if (m_satcount == 2) {
278 m_curfx = mmItemFXNull;
279 }
280 break;
281 }
282
283 // grab new fx.
284 if (m_curfx == mmItemFXNull) {
285 tmmItemFX newfx;
286 if (m_fxqueue.recv(&newfx)) {
287 m_process_speed = 0.0f;
288 m_curfx = newfx;
289 }
290 }
291
292 m_last_frametime = UI_TIME();
293 }
294}
295
296//////////////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 6

ui_DrawSetFontFunction · 0.85
ui_DrawSetTextTypeFunction · 0.85
ui_SetCharAlphaFunction · 0.85
ui_DrawStringFunction · 0.85
UI_TIMEFunction · 0.85
recvMethod · 0.45

Tested by

no test coverage detected