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

Method Draw

netgames/dmfc/dmfcmenu.cpp:492–810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490 }
491}
492void MenuItem::Draw(int x, int y, int height, int bmp, float *not_used) {
493 int old_font = DLLgrtext_GetFont();
494 DLLgrtext_SetFont(basethis->Game_fonts[HUD_FONT_INDEX]);
495
496 /*
497 static float aspratio;
498 if(!ratio){
499 //we need to calculate a ratio
500 aspratio = DEFAULT_HUD_WIDTH / ((float)*base->Game_window_w);
501 }
502
503 float useratio;
504 if(!ratio) useratio = aspratio; else useratio = *ratio;
505 */
506
507 uint8_t alpha_to_use = 255;
508
509#define FLASHRATE 700.0 // alphas per second
510
511 int16_t a = m_Alpha;
512 int units = (int)FLASHRATE * (*basethis->Frametime);
513
514 // do alphaing effect
515 while (units > 0) {
516 if (m_AlphaDir) {
517 // find the amount to adjust
518 uint8_t amount = std::min<int>(255 - a, units);
519 units -= amount;
520 a += amount;
521 if (a >= 255) {
522 a = 255;
523 m_AlphaDir = false;
524 }
525 } else {
526 // find the amount to adjust
527 uint8_t amount = std::min<int>(a, units);
528 units -= amount;
529 a -= amount;
530 if (a <= 0) {
531 a = 0;
532 m_AlphaDir = true;
533 }
534 }
535 }
536
537 m_Alpha = alpha_to_use = (uint8_t)a;
538
539 ddgr_color color;
540 int temp, maxx;
541 temp = maxx = 0;
542 char buff[256];
543 char checked[3];
544 char buffer[100];
545
546 if (SubMenuCount <= 0) {
547 DLLgrtext_SetFont(old_font);
548 return;
549 }

Callers 2

DrawMenuMethod · 0.45

Calls 6

CheckPlayerNumMethod · 0.80
GetNumTeamsMethod · 0.80
GetTeamColorMethod · 0.80
BackMethod · 0.80
GR_RGBFunction · 0.50
GetTitleMethod · 0.45

Tested by

no test coverage detected