static void DrawStatus(void) { int w; if (m_servers.pingstage == PING_STAGES) w = m_servers.pingindex * uis.width / m_servers.list.numItems; else w = uis.width; R_DrawFill8(0, uis.height - CHAR_HEIGHT, w, CHAR_HEIGHT, 4); R_DrawFill8(w, uis.height - CHAR_HEIGHT, uis.width - w, CHAR_HEIGHT, 0); if (m_servers.status_c) UI_DrawString(uis.width / 2, uis.height - CHAR_HEIGHT, UI_CENTER, m_servers.status_c); if (uis.width < 800) return; if (m_servers.list.numItems) UI_DrawString(uis.width, uis.height - CHAR_HEIGHT, UI_RIGHT, m_servers.status_r); if (m_servers.list.numItems && m_servers.list.curvalue >= 0) { serverslot_t *slot = m_servers.list.items[m_servers.list.curvalue]; if (slot->status > SLOT_PENDING) { UI_DrawString(0, uis.height - CHAR_HEIGHT, UI_LEFT, slot->hostname); } } }
/* ================= ServerInfo_MenuDraw ================= */ static void ServerInfo_MenuDraw( void ) { const char *s; char key[MAX_INFO_KEY]; char value[MAX_INFO_VALUE]; int i = 0, y; y = SCREEN_HEIGHT/2 - s_serverinfo.numlines*(SMALLCHAR_HEIGHT)/2 - 20; s = s_serverinfo.info; while ( s && i < s_serverinfo.numlines ) { Info_NextPair( &s, key, value ); if ( !key[0] ) { break; } Q_strcat( key, MAX_INFO_KEY, ":" ); UI_DrawString(SCREEN_WIDTH*0.50 - 8,y,key,UI_RIGHT|UI_SMALLFONT,color_red); UI_DrawString(SCREEN_WIDTH*0.50 + 8,y,value,UI_LEFT|UI_SMALLFONT,text_color_normal); y += SMALLCHAR_HEIGHT; i++; } Menu_Draw( &s_serverinfo.menu ); }
/* ================= DriverInfo_MenuDraw ================= */ static void DriverInfo_MenuDraw(void) { int i; int y; Menu_Draw(&s_driverinfo.menu); UI_DrawString(320, 80, "VENDOR", UI_CENTER|UI_SMALLFONT, color_red); UI_DrawString(320, 152, "PIXELFORMAT", UI_CENTER|UI_SMALLFONT, color_red); UI_DrawString(320, 192, "EXTENSIONS", UI_CENTER|UI_SMALLFONT, color_red); UI_DrawString(320, 80+16, uis.glconfig.vendor_string, UI_CENTER|UI_SMALLFONT, text_color_normal); UI_DrawString(320, 96+16, uis.glconfig.version_string, UI_CENTER|UI_SMALLFONT, text_color_normal); UI_DrawString(320, 112+16, uis.glconfig.renderer_string, UI_CENTER|UI_SMALLFONT, text_color_normal); UI_DrawString(320, 152+16, va ("color(%d-bits) Z(%d-bits) stencil(%d-bits)", uis.glconfig.colorBits, uis.glconfig.depthBits, uis.glconfig.stencilBits), UI_CENTER|UI_SMALLFONT, text_color_normal); // double column y = 192+16; for (i=0; i<s_driverinfo.numstrings/2; i++) { UI_DrawString(320-4, y, s_driverinfo.strings[i*2], UI_RIGHT|UI_SMALLFONT, text_color_normal); UI_DrawString(320+4, y, s_driverinfo.strings[i*2+1], UI_LEFT|UI_SMALLFONT, text_color_normal); y += SMALLCHAR_HEIGHT; } if (s_driverinfo.numstrings & 1) UI_DrawString(320, y, s_driverinfo.strings[s_driverinfo.numstrings-1], UI_CENTER|UI_SMALLFONT, text_color_normal); }
/* ================= SpinControl_Draw ================= */ static void SpinControl_Draw(menulist_s* s) { float* color; int x, y; int style; qboolean focus; x = s->generic.x; y = s->generic.y; style = UI_SMALLFONT; focus = (s->generic.parent->cursor == s->generic.menuPosition); if (s->generic.flags & QMF_GRAYED) color = text_color_disabled; else if (focus) { color = text_color_highlight; style |= UI_PULSE; } else if (s->generic.flags & QMF_BLINK) { color = text_color_highlight; style |= UI_BLINK; } else color = text_color_normal; if (focus) { // draw cursor UI_FillRect(s->generic.left, s->generic.top, s->generic.right - s->generic.left + 1, s->generic.bottom - s->generic.top + 1, listbar_color); UI_DrawChar(x, y, 13, UI_CENTER | UI_BLINK | UI_SMALLFONT, color); } UI_DrawString(x - SMALLCHAR_WIDTH, y, s->generic.name, style | UI_RIGHT, color); UI_DrawString(x + SMALLCHAR_WIDTH, y, s->itemnames[s->curvalue], style | UI_LEFT, color); }
static void MenuDrawScoreLine(int n, int y) { int rank; char name[64], info[MAX_INFO_STRING]; if(n > (postgame.numClients + 1)) n -= (postgame.numClients + 2); if(n >= postgame.numClients) return; rank = postgame.ranks[n]; if(rank & RANK_TIED_FLAG){ UI_DrawString(640 - 31 * SMALLCHAR_WIDTH, y, "(tie)", UI_LEFT | UI_SMALLFONT, color_white); rank &= ~RANK_TIED_FLAG; } trap_GetConfigString(CS_PLAYERS + postgame.clientNums[n], info, MAX_INFO_STRING); Q_strncpyz(name, Info_ValueForKey(info, "n"), sizeof(name)); Q_cleanstr(name); UI_DrawString(640 - 25 * SMALLCHAR_WIDTH, y, va("#%i: %-16s %2i", rank + 1, name, postgame.scores[n]), UI_LEFT | UI_SMALLFONT, color_white); }
/* ================= ServerInfo_MenuDraw ================= */ static void ServerInfo_MenuDraw( void ) { const char *s; char key[MAX_INFO_KEY]; char value[MAX_INFO_VALUE]; int y, i=0; int keylen, vallen, infonum=-1; UI_DrawIngameBG(); UI_DrawProportionalString( 320, 110, "SERVER INFO",UI_CENTER|UI_SMALLFONT,color_black); y = 140;//95; s = s_serverinfo.info; s_serverinfo.numdrawn = 0; while ( s && i < s_serverinfo.numlines ) { i++; Info_NextPair( &s, key, value ); if ( !key[0] ) { break; } infonum++; if(s_serverinfo.firstline>infonum) continue; if(y>260) break; Com_sprintf(key,MAX_INFO_KEY,"%s: ",key); keylen=Q_PrintStrlen(key); vallen=Q_PrintStrlen(value); if(keylen+vallen<20) { UI_DrawString(230,y,key,UI_LEFT|UI_SMALLFONT,color_black); UI_DrawString(230+keylen*8,y,value,UI_LEFT|UI_SMALLFONT,color_blue); s_serverinfo.numdrawn++; } else { int i; // TODO: Also add linebreaks for long keys? UI_DrawString(230,y,key,UI_LEFT|UI_SMALLFONT,color_black); for(i=0;i<vallen;i+=20) { y += SMALLCHAR_HEIGHT; if(y>260) break; UI_DrawString(230,y,va("%20.20s",&value[i]),UI_LEFT|UI_SMALLFONT,color_blue); s_serverinfo.numdrawn++; } } y += SMALLCHAR_HEIGHT; } Menu_Draw( &s_serverinfo.menu ); }
/* ================= RadioButton_Draw ================= */ static void RadioButton_Draw( menuradiobutton_s *rb ) { int x; int y; float *color; int style; qboolean focus; int picY; x = rb->generic.x; y = rb->generic.y; focus = (rb->generic.parent->cursor == rb->generic.menuPosition); if ( rb->generic.flags & QMF_GRAYED ) { color = text_color_disabled; style = UI_LEFT|UI_SMALLFONT; } else if ( focus ) { color = text_color_highlight; style = UI_LEFT|UI_PULSE|UI_SMALLFONT; } else { color = text_color_normal; style = UI_LEFT|UI_SMALLFONT; } if ( focus ) { // draw cursor CG_FillRect( rb->generic.left, rb->generic.top, rb->generic.right-rb->generic.left+1, rb->generic.bottom-rb->generic.top+1, listbar_color ); UI_DrawChar( x, y, GLYPH_ARROW, UI_CENTER|UI_BLINK|UI_SMALLFONT, color); } if ( rb->generic.name ) UI_DrawString( x - SMALLCHAR_WIDTH, y, rb->generic.name, UI_RIGHT|UI_SMALLFONT, color ); // center ratio button on box and move down 2 pixels at 16 pt size picY = rb->generic.top + ( rb->generic.bottom - rb->generic.top ) / 2 - 16 / 2 + 2.0f * SMALLCHAR_HEIGHT / 16.0f; if ( !rb->curvalue ) { CG_DrawPic( x + SMALLCHAR_WIDTH, picY, 16, 16, uis.rb_off); UI_DrawString( x + SMALLCHAR_WIDTH + 16, y, "off", style, color ); } else { CG_DrawPic( x + SMALLCHAR_WIDTH, picY, 16, 16, uis.rb_on ); UI_DrawString( x + SMALLCHAR_WIDTH + 16, y, "on", style, color ); } }
/* =============== UI_CreditMenu_Draw =============== */ static void UI_CreditMenu_Draw( void ) { int y; y = 12; UI_DrawProportionalString( 320, y, "id Software is:", UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Programming", UI_CENTER|UI_SMALLFONT, color_white ); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "John Carmack, Robert A. Duffy, Jim Dose'", UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Art", UI_CENTER|UI_SMALLFONT, color_white ); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Adrian Carmack, Kevin Cloud,", UI_CENTER|UI_SMALLFONT, color_white ); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Kenneth Scott, Seneca Menard, Fred Nilsson", UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Game Designer", UI_CENTER|UI_SMALLFONT, color_white ); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Graeme Devine", UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Level Design", UI_CENTER|UI_SMALLFONT, color_white ); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Tim Willits, Christian Antkow, Paul Jaquays", UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "CEO", UI_CENTER|UI_SMALLFONT, color_white ); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Todd Hollenshead", UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Director of Business Development", UI_CENTER|UI_SMALLFONT, color_white ); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Marty Stratton", UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Biz Assist and id Mom", UI_CENTER|UI_SMALLFONT, color_white ); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Donna Jackson", UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Development Assistance", UI_CENTER|UI_SMALLFONT, color_white ); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString( 320, y, "Eric Webb", UI_CENTER|UI_SMALLFONT, color_white ); y += 1.35 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawString( 320, y, "To order: 1-800-idgames www.quake3arena.com www.idsoftware.com", UI_CENTER|UI_SMALLFONT, color_red ); y += SMALLCHAR_HEIGHT; UI_DrawString( 320, y, "Quake III Arena(c) 1999-2000, Id Software, Inc. All Rights Reserved", UI_CENTER|UI_SMALLFONT, color_red ); }
/* ================= RadioButton_Draw ================= */ static void RadioButton_Draw( menuradiobutton_s *rb ) { int x; int y; float *color; int style; qboolean focus; x = rb->generic.x; y = rb->generic.y; focus = (rb->generic.parent->cursor == rb->generic.menuPosition); if ( rb->generic.flags & QMF_GRAYED ) { color = text_color_disabled; style = UI_LEFT|UI_SMALLFONT; } else if ( focus ) { color = text_color_highlight; style = UI_LEFT|UI_PULSE|UI_SMALLFONT; } else { color = text_color_normal; style = UI_LEFT|UI_SMALLFONT; } if ( focus ) { // draw cursor UI_FillRect( rb->generic.left, rb->generic.top, rb->generic.right-rb->generic.left+1, rb->generic.bottom-rb->generic.top+1, listbar_color ); UI_DrawChar( x, y, 13, UI_CENTER|UI_BLINK|UI_SMALLFONT, color); } if ( rb->generic.name ) UI_DrawString( x - SMALLCHAR_WIDTH, y, rb->generic.name, UI_RIGHT|UI_SMALLFONT, color ); if ( !rb->curvalue ) { UI_DrawHandlePic( x + SMALLCHAR_WIDTH, y + 2, 16, 16, uis.rb_off); UI_DrawString( x + SMALLCHAR_WIDTH + 16, y, "off", style, color ); } else { UI_DrawHandlePic( x + SMALLCHAR_WIDTH, y + 2, 16, 16, uis.rb_on ); UI_DrawString( x + SMALLCHAR_WIDTH + 16, y, "on", style, color ); } }
/* =============== UI_CreditMenu_Draw =============== */ static void UI_CreditMenu_Draw(void) { int y; y = 16; UI_DrawProportionalString(320, y, "id Software is:", UI_CENTER|UI_SMALLFONT, color_white); y += 1.65 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Programming", UI_CENTER|UI_SMALLFONT, color_white); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "John Carmack, John Cash", UI_CENTER|UI_SMALLFONT, color_white); y += 1.65 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Art", UI_CENTER|UI_SMALLFONT, color_white); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Adrian Carmack, Kevin Cloud,", UI_CENTER|UI_SMALLFONT, color_white); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Paul Steed, Kenneth Scott", UI_CENTER|UI_SMALLFONT, color_white); y += 1.65 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Game Designer", UI_CENTER|UI_SMALLFONT, color_white); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Graeme Devine", UI_CENTER|UI_SMALLFONT, color_white); y += 1.65 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Level Design", UI_CENTER|UI_SMALLFONT, color_white); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Tim Willits, Christian Antkow, Paul Jaquays", UI_CENTER|UI_SMALLFONT, color_white); y += 1.65 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "CEO", UI_CENTER|UI_SMALLFONT, color_white); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Todd Hollenshead", UI_CENTER|UI_SMALLFONT, color_white); y += 1.65 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Director of Business Development", UI_CENTER|UI_SMALLFONT, color_white); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Katherine Anna Kang", UI_CENTER|UI_SMALLFONT, color_white); y += 1.65 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Biz Assist and id Mom", UI_CENTER|UI_SMALLFONT, color_white); y += PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawProportionalString(320, y, "Donna Jackson", UI_CENTER|UI_SMALLFONT, color_white); y += 1.65 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; UI_DrawString(320, y, "To order: 1-800-idgames www.quake3arena.com www.idsoftware.com", UI_CENTER|UI_SMALLFONT, color_red); y += SMALLCHAR_HEIGHT; UI_DrawString(320, y, "Quake III Arena(c) 1999-2000, Id Software, Inc. All Rights Reserved", UI_CENTER|UI_SMALLFONT, color_red); }
/* =============== UI_CreditMenu_Draw_ioq3 =============== */ static void UI_CreditMenu_Draw_ioq3( void ) { int y; int i; static const char *names[] = { "", S_COLOR_YELLOW "id Software", S_COLOR_RED "ioquake3 contributors", S_COLOR_GREEN "Spearmint contributors", "", "...and many, many others!", // keep this one last. NULL }; // Center text vertically on the screen y = (SCREEN_HEIGHT - ARRAY_LEN(names) * (1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE)) / 2; UI_DrawProportionalString( 320, y, "Spearmint Quake 3 credits:", UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; for (i = 0; names[i]; i++) { UI_DrawProportionalString( 320, y, names[i], UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; } UI_DrawString( 320, 459, "http://spearmint.pw", UI_CENTER|UI_SMALLFONT, colorGreen ); }
/** * @brief Generic tooltip function */ int UI_DrawTooltip (const char* string, int x, int y, int maxWidth) { const char* font = "f_small"; int height = 0, width = 0; if (Q_strnull(string) || !font) return 0; R_FontTextSize(font, string, maxWidth, LONGLINES_WRAP, &width, &height, nullptr, nullptr); if (!width) return 0; x += 5; y += 5; if (x + width + 3 > VID_NORM_WIDTH) x -= width + 10; if (y + height + 3 > VID_NORM_HEIGHT) y -= height + 10; UI_DrawFill(x - 1, y - 1, width + 4, height + 4, tooltipBG); R_Color(tooltipColor); UI_DrawString(font, ALIGN_UL, x + 1, y + 1, x + 1, maxWidth, 0, string); R_Color(nullptr); return width; }
static void datadropper_draw_cb(const struct bContext *C, ARegion *ar, void *arg) { DataDropper *ddr = arg; int width; const char *name = ddr->name; wmWindow *win = CTX_wm_window(C); int x = win->eventstate->x; int y = win->eventstate->y; if ((name[0] == '\0') || (BLI_rcti_isect_pt(&ar->winrct, x, y) == false)) { return; } width = UI_GetStringWidth(name); x = x - ar->winrct.xmin; y = y - ar->winrct.ymin; y += 20; glColor4ub(0, 0, 0, 50); uiSetRoundBox(UI_CNR_ALL | UI_RB_ALPHA); uiRoundBox(x, y, x + width + 8, y + 15, 4); glColor4ub(255, 255, 255, 255); UI_DrawString(x + 4, y + 4, name); }
static void SCRQ2_DrawHUDString( const char* string, int x, int y, int centerwidth, int _xor ) { int margin = x; while ( *string ) { // scan out one line of text from the string int width = 0; char line[ 1024 ]; while ( *string && *string != '\n' ) { line[ width++ ] = *string++; } line[ width ] = 0; if ( centerwidth ) { x = margin + ( centerwidth - width * 8 ) / 2; } else { x = margin; } UI_DrawString( x, y, line, _xor ); if ( *string ) { string++; // skip the \n x = margin; y += 8; } } }
/* ================= UIE_AwardIcons_DrawValues ================= */ void UIE_AwardIcons_DrawValues(awardInfo_t* a) { int x, y, i, n; int level; char string[64]; y = AWARDS_Y - a->iconRaise; i = 0; for( n = 0; n < 6; n++ ) { level = a->levels[n]; if( level > 0 ) { x = AwardIcons_PositionX(a, i); i++; if( level == 1 ) { continue; } if( level >= 1000000 ) { Com_sprintf( string, sizeof(string), "%im", level / 1000000 ); } else if( level >= 1000 ) { Com_sprintf( string, sizeof(string), "%ik", level / 1000 ); } else { Com_sprintf( string, sizeof(string), "%i", level ); } UI_DrawString( x + 24, y + 48, string, UI_CENTER, color_yellow ); } } }
/* ================= Text_Draw ================= */ static void Text_Draw( menutext_s *t ) { int x; int y; char buff[512]; float* color; x = t->generic.x; y = t->generic.y; buff[0] = '\0'; // possible label if (t->generic.name) Q_strncpyz( buff, t->generic.name, sizeof (buff) ); // possible value if (t->string) Q_strcat( buff, sizeof (buff), t->string ); if (t->generic.flags & QMF_GRAYED) color = text_color_disabled; else color = t->color; UI_DrawString( x, y, buff, t->style, color ); }
static void draw_render_info(Scene *scene, Image *ima, ARegion *ar) { RenderResult *rr; rcti rect; float colf[3]; rr= BKE_image_acquire_renderresult(scene, ima); if(rr && rr->text) { rect= ar->winrct; rect.xmin= 0; rect.ymin= ar->winrct.ymax - ar->winrct.ymin - HEADER_HEIGHT; rect.xmax= ar->winrct.xmax - ar->winrct.xmin; rect.ymax= ar->winrct.ymax - ar->winrct.ymin; /* clear header rect */ UI_GetThemeColor3fv(TH_BACK, colf); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glColor4f(colf[0]+0.1f, colf[1]+0.1f, colf[2]+0.1f, 0.5f); glRecti(rect.xmin, rect.ymin, rect.xmax, rect.ymax+1); glDisable(GL_BLEND); UI_ThemeColor(TH_TEXT_HI); UI_DrawString(12, rect.ymin + 5, rr->text); } BKE_image_release_renderresult(scene, ima); }
/* =============== UI_CreditMenu_Draw_ioq3 =============== */ static void UI_CreditMenu_Draw_ioq3( void ) { int y; int i; // These are all people that have made commits to Subversion, and thus // probably incomplete. // (These are in alphabetical order, for the defense of everyone's egos.) static const char *names[] = { "Tim Angus", "James Canete", "Vincent Cojot", "Ryan C. Gordon", "Aaron Gyes", "Zack Middleton", "Ludwig Nussel", "Julian Priestley", "Scirocco Six", "Thilo Schulz", "Zachary J. Slater", "Tony J. White", "...and many, many others!", // keep this one last. NULL }; y = 12; UI_DrawProportionalString( 320, y, "ioquake3 contributors:", UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; for (i = 0; names[i]; i++) { UI_DrawProportionalString( 320, y, names[i], UI_CENTER|UI_SMALLFONT, color_white ); y += 1.42 * PROP_HEIGHT * PROP_SMALL_SIZE_SCALE; } UI_DrawString( 320, 459, "http://www.ioquake3.org/", UI_CENTER|UI_SMALLFONT, color_red ); }
static void UI_SPPostgameMenu_DrawAwardsMedals( int max ) { int n; int medal; int amount; int x, y; char buf[16]; for( n = 0; n < max; n++ ) { x = medalLocations[n]; y = 64; medal = postgameMenuInfo.awardsEarned[n]; amount = postgameMenuInfo.awardsLevels[n]; UI_DrawNamedPic( x, y, 48, 48, ui_medalPicNames[medal] ); if( medal == AWARD_ACCURACY ) { Com_sprintf( buf, sizeof(buf), "%i%%", amount ); } else { if( amount == 1 ) { continue; } Com_sprintf( buf, sizeof(buf), "%i", amount ); } UI_DrawString( x + 24, y + 52, buf, UI_CENTER, color_yellow ); } }
/* ================= Action_Draw ================= */ static void Action_Draw(menuaction_s* a) { int x, y; int style; float* color; style = 0; color = menu_text_color; if (a->generic.flags & QMF_GRAYED) { color = text_color_disabled; } else if ((a->generic.flags & QMF_PULSEIFFOCUS) && (a->generic.parent->cursor == a->generic.menuPosition)) { color = text_color_highlight; style = UI_PULSE; } else if ((a->generic.flags & QMF_HIGHLIGHT_IF_FOCUS) && (a->generic.parent->cursor == a->generic.menuPosition)) { color = text_color_highlight; } else if (a->generic.flags & QMF_BLINK) { style = UI_BLINK; color = text_color_highlight; } x = a->generic.x; y = a->generic.y; UI_DrawString(x, y, a->generic.name, UI_LEFT | style, color); if (a->generic.parent->cursor == a->generic.menuPosition) { // draw cursor UI_DrawChar(x - BIGCHAR_WIDTH, y, 13, UI_LEFT | UI_BLINK, color); } }
static void Draw( menuFrameWork_t *self ) { Menu_Draw( self ); if( uis.width >= 640 ) { UI_DrawString( uis.width, uis.height - CHAR_HEIGHT, UI_RIGHT, m_demos.status ); } }
/* ================= UI_Credits_DrawFunc ================= */ static void UI_Credits_DrawFunc( void ) { int i, y; float speed = 40.0f; int w = UI_MED_CHAR_WIDTH; int h = UI_MED_CHAR_HEIGHT; int color = 0; // draw the background first if( !uiCredits.finalCredits && !CVAR_GET_FLOAT( "sv_background" )) UI_DrawPic( 0, 0, 1024 * uiStatic.scaleX, 768 * uiStatic.scaleY, uiColorWhite, ART_BACKGROUND ); else speed = 45.0f; // syncronize with final background track :-) // otherwise running on cutscene speed = 32.0f * (768.0f / ScreenHeight); // now draw the credits UI_ScaleCoords( NULL, NULL, &w, &h ); y = ScreenHeight - (((gpGlobals->time * 1000) - uiCredits.startTime ) / speed ); // draw the credits for ( i = 0; i < uiCredits.numLines && uiCredits.credits[i]; i++, y += h ) { // skip not visible lines, but always draw end line if( y <= -h && i != uiCredits.numLines - 1 ) continue; if(( y < ( ScreenHeight - h ) / 2 ) && i == uiCredits.numLines - 1 ) { if( !uiCredits.fadeTime ) uiCredits.fadeTime = (gpGlobals->time * 1000); color = UI_FadeAlpha( uiCredits.fadeTime, uiCredits.showTime ); if( UnpackAlpha( color )) UI_DrawString( 0, ( ScreenHeight - h ) / 2, 1024 * uiStatic.scaleX, h, uiCredits.credits[i], color, true, w, h, 1, true ); } else UI_DrawString( 0, y, 1024 * uiStatic.scaleX, h, uiCredits.credits[i], uiColorWhite, false, w, h, 1, true ); } if( y < 0 && UnpackAlpha( color ) == 0 ) { uiCredits.active = false; // end of credits if( uiCredits.finalCredits ) HOST_ENDGAME( gMenu.m_gameinfo.title ); } if( !uiCredits.active ) UI_PopMenu(); }
void uiSelectBoxNode::draw (uiNode_t* node) { uiNode_t* option; int selBoxX, selBoxY; const char* ref; const char* font; vec2_t nodepos; const char* imageName; const image_t* image; static vec4_t invisColor = {1.0, 1.0, 1.0, 0.7}; ref = UI_AbstractOptionGetCurrentValue(node); if (ref == nullptr) return; UI_GetNodeAbsPos(node, nodepos); imageName = UI_GetReferenceString(node, node->image); if (!imageName) imageName = "ui/selectbox"; image = UI_LoadImage(imageName); font = UI_GetFontFromNode(node); selBoxX = nodepos[0] + SELECTBOX_SIDE_WIDTH; selBoxY = nodepos[1] + SELECTBOX_SPACER; /* left border */ UI_DrawNormImage(false, nodepos[0], nodepos[1], SELECTBOX_SIDE_WIDTH, node->box.size[1], SELECTBOX_SIDE_WIDTH, SELECTBOX_DEFAULT_HEIGHT, 0.0f, 0.0f, image); /* stretched middle bar */ UI_DrawNormImage(false, nodepos[0] + SELECTBOX_SIDE_WIDTH, nodepos[1], node->box.size[0]-SELECTBOX_SIDE_WIDTH-SELECTBOX_RIGHT_WIDTH, node->box.size[1], 12.0f, SELECTBOX_DEFAULT_HEIGHT, 7.0f, 0.0f, image); /* right border (arrow) */ UI_DrawNormImage(false, nodepos[0] + node->box.size[0] - SELECTBOX_RIGHT_WIDTH, nodepos[1], SELECTBOX_DEFAULT_HEIGHT, node->box.size[1], 12.0f + SELECTBOX_RIGHT_WIDTH, SELECTBOX_DEFAULT_HEIGHT, 12.0f, 0.0f, image); /* draw the label for the current selected option */ for (option = UI_AbstractOptionGetFirstOption(node); option; option = option->next) { if (!Q_streq(OPTIONEXTRADATA(option).value, ref)) continue; if (option->invis) R_Color(invisColor); const char* label = CL_Translate(OPTIONEXTRADATA(option).label); UI_DrawString(font, ALIGN_UL, selBoxX, selBoxY, selBoxX, node->box.size[0] - 4, 0, label, 0, 0, nullptr, false, LONGLINES_PRETTYCHOP); R_Color(nullptr); break; } /* must we draw the drop-down list */ if (UI_GetMouseCapture() == node) { UI_CaptureDrawOver(node); } }
/* ================= ScrollList_Draw ================= */ void ScrollList_Draw( menulist_s *l ) { int x; int u; int y; int i; int base; int column; float* color; qboolean hasfocus; int style; hasfocus = (l->generic.parent->cursor == l->generic.menuPosition); x = l->generic.x; for( column = 0; column < l->columns; column++ ) { y = l->generic.y; base = l->top + column * l->height; for( i = base; i < base + l->height; i++) { if (i >= l->numitems) break; if (i == l->curvalue) { u = x - 2; if( l->generic.flags & QMF_CENTER_JUSTIFY ) { u -= (l->width * SMALLCHAR_WIDTH) / 2 + 1; } CG_FillRect(u,y,l->width*SMALLCHAR_WIDTH,SMALLCHAR_HEIGHT+2,listbar_color); color = text_color_highlight; if (hasfocus) style = UI_PULSE|UI_LEFT|UI_SMALLFONT; else style = UI_LEFT|UI_SMALLFONT; } else { color = text_color_normal; style = UI_LEFT|UI_SMALLFONT; } if( l->generic.flags & QMF_CENTER_JUSTIFY ) { style &= ~UI_FORMATMASK; style |= UI_CENTER; } UI_DrawString( x, y, l->itemnames[i], style, color); y += SMALLCHAR_HEIGHT; } x += (l->width + l->seperation) * SMALLCHAR_WIDTH; } }
/* ================= Slider_Draw ================= */ static void Slider_Draw( menuslider_s *s ) { int x; int y; int style; float *color; int button; qboolean focus; x = s->generic.x; y = s->generic.y; focus = (s->generic.parent->cursor == s->generic.menuPosition); if( s->generic.flags & QMF_GRAYED ) { color = text_color_disabled; style = UI_SMALLFONT; } else if( focus ) { color = text_color_highlight; style = UI_SMALLFONT | UI_PULSE; } else { color = text_color_normal; style = UI_SMALLFONT; } // draw label UI_DrawString( x - SMALLCHAR_WIDTH, y, s->generic.name, UI_RIGHT|style, color ); // draw slider trap_R_SetColor( color ); CG_DrawPic( x + SMALLCHAR_WIDTH, y, 96, 16, sliderBar ); trap_R_SetColor( NULL ); // clamp thumb if( s->maxvalue > s->minvalue ) { s->range = ( s->curvalue - s->minvalue ) / ( float ) ( s->maxvalue - s->minvalue ); if( s->range < 0 ) { s->range = 0; } else if( s->range > 1) { s->range = 1; } } else { s->range = 0; } // draw thumb if( style & UI_PULSE) { button = sliderButton_1; } else { button = sliderButton_0; } CG_DrawPic( (int)( x + 2*SMALLCHAR_WIDTH + (SLIDER_RANGE-1)*SMALLCHAR_WIDTH* s->range ) - 2, y - 2, 12, 20, button ); }
/* ================== MenuField_Draw ================== */ void MenuField_Draw( menufield_s *f ) { int x; int y; int w; int h; int style; qboolean focus; float *color; x = f->generic.x; y = f->generic.y; if (f->generic.flags & QMF_SMALLFONT) { w = SMALLCHAR_WIDTH; h = SMALLCHAR_HEIGHT; style = UI_SMALLFONT; } else { w = BIGCHAR_WIDTH; h = BIGCHAR_HEIGHT; style = UI_BIGFONT; } if (Menu_ItemAtCursor( f->generic.parent ) == f) { focus = qtrue; style |= UI_PULSE; } else { focus = qfalse; } if (f->generic.flags & QMF_GRAYED) color = text_color_disabled; else if (focus) color = text_color_highlight; else color = text_color_normal; if ( focus ) { // draw cursor UI_FillRect( f->generic.left, f->generic.top, f->generic.right-f->generic.left+1, f->generic.bottom-f->generic.top+1, listbar_color ); UI_DrawChar( x, y, 13, UI_CENTER|UI_BLINK|style, color); } if ( f->generic.name ) { UI_DrawString( x - w, y, f->generic.name, style|UI_RIGHT, color ); } MField_Draw( &f->field, x + w, y, style, color ); }
/** * @brief draw a line into a bounding box * @param[in] fontID the font id (defined in ufos/fonts.ufo) * @param[in] align Align of the text into the bounding box * @param[in] x,y Current position of the bounded box * @param[in] width Current width of the bounded box * @param[in] height Current height of the bounded box * @param[in] text The string to draw * @param[in] method Truncation method * @image html http://ufoai.org/wiki/images/Text_position.png * @note the x, y, width and height values are all normalized here - don't use the * viddef settings for drawstring calls - make them all relative to VID_NORM_WIDTH * and VID_NORM_HEIGHT * @todo remove the use of UI_DrawString * @todo test the code for multiline? * @todo fix problem with truncation (maybe problem into UI_DrawString) */ int UI_DrawStringInBox (const char* fontID, align_t align, int x, int y, int width, int height, const char* text, longlines_t method) { const align_t horizontalAlign = (align_t)(align % 3); /* left, center, right */ const align_t verticalAlign = (align_t)(align / 3); /* top, center, bottom */ /* position of the text for UI_DrawString */ const int xx = x + ((width * horizontalAlign) >> 1); const int yy = y + ((height * verticalAlign) >> 1); return UI_DrawString(fontID, align, xx, yy, xx, width, 0, text, 0, 0, nullptr, false, method); }
/** * @brief Draws the current downloading status * @sa SCR_DrawLoadingBar * @sa CL_StartHTTPDownload * @sa CL_HTTP_Progress */ static void SCR_DrawDownloading (void) { const char *dlmsg = va(_("Downloading [%s]"), cls.downloadName); UI_DrawString("f_menubig", ALIGN_UC, (int)(viddef.virtualWidth / 2), (int)(viddef.virtualHeight / 2 - 60), (int)(viddef.virtualWidth / 2), viddef.virtualWidth, 50, dlmsg, 1, 0, NULL, qfalse, 0); SCR_DrawLoadingBar((int)(viddef.virtualWidth / 2) - 300, viddef.virtualHeight - 30, 600, 20, (int)cls.downloadPercent); }
/* ================= Slider_Draw ================= */ static void Slider_Draw(menuslider_s* s) { float* color; int style; int i; int x; int y; qboolean focus; x = s->generic.x; y = s->generic.y; focus = (s->generic.parent->cursor == s->generic.menuPosition); style = UI_SMALLFONT; if (s->generic.flags & QMF_GRAYED) { color = text_color_disabled; } else if (focus) { color = text_color_highlight; style |= UI_PULSE; } else { color = text_color_normal; } if (focus) { // draw cursor UI_FillRect(s->generic.left, s->generic.top, s->generic.right - s->generic.left + 1, s->generic.bottom - s->generic.top + 1, listbar_color); UI_DrawChar(x, y, 13, UI_CENTER | UI_BLINK | UI_SMALLFONT, color); } // draw label UI_DrawString(x - SMALLCHAR_WIDTH, y, s->generic.name, UI_RIGHT | style, color); // draw slider UI_DrawChar(x + SMALLCHAR_WIDTH, y, 128, UI_LEFT | style, color); for (i = 0; i < SLIDER_RANGE; i++) UI_DrawChar(x + (i + 2)*SMALLCHAR_WIDTH, y, 129, UI_LEFT | style, color); UI_DrawChar(x + (i + 2)*SMALLCHAR_WIDTH, y, 130, UI_LEFT | style, color); // clamp thumb if (s->maxvalue > s->minvalue) { s->range = (s->curvalue - s->minvalue) / (float)(s->maxvalue - s->minvalue); if (s->range < 0) s->range = 0; else if (s->range > 1) s->range = 1; } else s->range = 0; // draw thumb if (style & UI_PULSE) { style &= ~UI_PULSE; style |= UI_BLINK; } UI_DrawChar((int)(x + 2 * SMALLCHAR_WIDTH + (SLIDER_RANGE - 1)*SMALLCHAR_WIDTH * s->range), y, 131, UI_LEFT | style, color); }
static void wm_drop_operator_draw(char *name, int x, int y) { int width= UI_GetStringWidth(name); glColor4ub(0, 0, 0, 50); uiSetRoundBox(UI_CNR_ALL | UI_RB_ALPHA); uiRoundBox(x, y, x + width + 8, y + 15, 4); glColor4ub(255, 255, 255, 255); UI_DrawString(x+4, y+4, name); }