static void KeyCursorDrawFunc( menuframework_s *menu ) { if (bind_grab) SCR_DrawChar (menu->x, menu->y + menu->cursor * MENU_LINE_SIZE, ALIGN_CENTER, '=', 255,255,255,255, false, true); // R_DrawChar ( SCR_ScaledVideo(menu->x), SCR_ScaledVideo(menu->y + menu->cursor * MENU_LINE_SIZE), // '=', SCR_VideoScale(), 255,255,255,255, false, true); else { /* SCR_DrawChar (menu->x, menu->y + menu->cursor * MENU_LINE_SIZE, ALIGN_CENTER, 12+((int)(Sys_Milliseconds()/250)&1), 255,255,255,255, false, true); */ SCR_DrawChar (menu->x+ (5*sin(anglemod(cl.time*0.01))), menu->y + menu->cursor * MENU_LINE_SIZE, ALIGN_CENTER, 13, 255,255,255, 255, false, true); } /* R_DrawChar ( SCR_ScaledVideo(menu->x), SCR_ScaledVideo(menu->y + menu->cursor * MENU_LINE_SIZE), 12 + ( ( int ) ( Sys_Milliseconds() / 250 ) & 1 ), SCR_VideoScale(), 255,255,255,255, false, true);*/ }
void Slider_Draw (menuslider_s *s) { int i, alpha = mouseOverAlpha(&s->generic); Menu_DrawStringR2LDark (s->generic.x + s->generic.parent->x + LCOLUMN_OFFSET, s->generic.y + s->generic.parent->y, s->generic.name, alpha); s->range = (s->curvalue - s->minvalue) / (float)(s->maxvalue - s->minvalue); if (s->range < 0) s->range = 0; if (s->range > 1) s->range = 1; SCR_DrawChar (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET, s->generic.y + s->generic.parent->y, ALIGN_CENTER, 128, 255,255,255,255, false, false); for (i = 0; i < SLIDER_RANGE; i++) SCR_DrawChar (s->generic.x + s->generic.parent->x + (i+1)*MENU_FONT_SIZE + RCOLUMN_OFFSET, s->generic.y + s->generic.parent->y, ALIGN_CENTER, 129, 255,255,255,255, false, false); SCR_DrawChar (s->generic.x + s->generic.parent->x + (i+1)*MENU_FONT_SIZE + RCOLUMN_OFFSET, s->generic.y + s->generic.parent->y, ALIGN_CENTER, 130, 255,255,255,255, false, false); SCR_DrawChar (s->generic.x + s->generic.parent->x + MENU_FONT_SIZE*((SLIDER_RANGE-1)*s->range+1) + RCOLUMN_OFFSET, s->generic.y + s->generic.parent->y, ALIGN_CENTER, 131, 255,255,255,255, false, true); }
/* ================== SCR_DrawBigString[Color] Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. Coordinates are at 640 by 480 virtual resolution ================== */ void SCR_DrawStringExt(int x, int y, float size, const char *string, float *setColor, bool forceColor, bool noColorEscape ) { vec4_t color; const char *s; int xx; // draw the drop shadow color[0] = color[1] = color[2] = 0; color[3] = setColor[3]; re.SetColor(color); s = string; xx = x; while(*s) { if(!noColorEscape && Q_IsColorString(s)) { s += 2; continue; } SCR_DrawChar(xx + 2, y + 2, size, *s); xx += size; s++; } // draw the colored text s = string; xx = x; re.SetColor(setColor); while(*s) { if(Q_IsColorString(s)) { if(!forceColor) { if(*(s + 1) == COLOR_NULL) { memcpy(color, setColor, sizeof(color)); } else { memcpy(color, g_color_table[ColorIndex(*(s + 1))], sizeof(color)); color[3] = setColor[3]; } color[3] = setColor[3]; re.SetColor(color); } if( !noColorEscape ) { s += 2; continue; } } SCR_DrawChar(xx, y, size, *s); xx += size; s++; } re.SetColor(NULL); }
void SCR_DrawStringExtNoShadow( int x, int y, float size, const char *string, float *setColor, qboolean forceColor ) { vec4_t color; const char *s; int xx; // draw the colored text s = string; xx = x; re.SetColor( setColor ); while ( *s ) { if ( Q_IsColorString( s ) ) { if ( !forceColor ) { Com_Memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) ); color[3] = setColor[3]; re.SetColor( color ); } s += 2; continue; } SCR_DrawChar( xx, y, size, *s ); xx += size; s++; } re.SetColor( NULL ); }
/* ================== SCR_DrawBigString[Color] Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. Coordinates are at 640 by 480 virtual resolution ================== */ void SCR_DrawStringExt( int x, int y, float size, const char *string, float *setColor, qboolean forceColor, qboolean noColorEscape ) { vec4_t color; const char *s; int xx; // draw the drop shadow color[0] = color[1] = color[2] = 0; color[3] = setColor[3]; re->SetColor( color ); s = string; xx = x; while ( *s ) { int colorLen = Q_parseColorString( s, nullptr ); if ( !noColorEscape && colorLen ) { s += colorLen; continue; } SCR_DrawChar( xx+2, y+2, size, *s ); xx += size; s++; } // draw the colored text s = string; xx = x; re->SetColor( setColor ); while ( *s ) { int colorLen = Q_parseColorString( s, color ); if ( colorLen ) { if ( !forceColor ) { color[3] = setColor[3]; re->SetColor( color ); } if ( !noColorEscape ) { s += colorLen; continue; } } SCR_DrawChar( xx, y, size, *s ); xx += size; s++; } re->SetColor( NULL ); }
/* ================== SCR_DrawBigString[Color] Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. Coordinates are at 640 by 480 virtual resolution ================== */ void SCR_DrawStringExt( int x, int y, float size, const char *string, float *setColor, qboolean forceColor ) { vec4_t color; const char *s; int xx; const bool use102color = MV_USE102COLOR; // draw the drop shadow color[0] = color[1] = color[2] = 0; color[3] = setColor[3]; re.SetColor( color ); s = string; xx = x; while ( *s ) { if ( Q_IsColorString( s ) || (use102color && Q_IsColorString_1_02( s ))) { s += 2; continue; } SCR_DrawChar( xx+2, y+2, size, *s ); xx += size; s++; } // draw the colored text s = string; xx = x; re.SetColor( setColor ); while ( *s ) { if ( Q_IsColorString( s ) || (use102color && Q_IsColorString_1_02( s ))) { if ( !forceColor ) { Com_Memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) ); color[3] = setColor[3]; re.SetColor( color ); } s += 2; continue; } SCR_DrawChar( xx, y, size, *s ); xx += size; s++; } re.SetColor( NULL ); }
// Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. // Coordinates are 640x480 virtual values void SCR_DrawStringExt( int x, int y, float size, const char *string, const vector4 *setColor, qboolean forceColor, qboolean noColorEscape ) { vector4 color; const char *s; int xx; // draw the drop shadow VectorSet4( &color, 0.0f, 0.0f, 0.0f, setColor->a ); re->SetColor( &color ); s = string; xx = x; while ( *s ) { if ( !noColorEscape && Q_IsColorString( s ) ) { s += 2; continue; } SCR_DrawChar( xx+2, y+2, size, *s ); xx += (int)size; s++; } // draw the colored text s = string; xx = x; re->SetColor( setColor ); while ( *s ) { if ( Q_IsColorString( s ) ) { if ( !forceColor ) { memcpy( &color, &g_color_table[ColorIndex(*(s+1))], sizeof( color ) ); color.a = setColor->a; re->SetColor( &color ); } if ( !noColorEscape ) { s += 2; continue; } } SCR_DrawChar( xx, y, size, *s ); xx += (int)size; s++; } re->SetColor( NULL ); }
/* ================== SCR_DrawBigString[Color] Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. Coordinates are at 640 by 480 virtual resolution ================== */ void SCR_DrawStringExt( int x, int y, float size, const char *string, float *setColor, qboolean forceColor, qboolean noColorEscape ) { vec4_t color; const char *s; int xx; // draw the drop shadow color[0] = color[1] = color[2] = 0; color[3] = setColor[3]; re.SetColor( color ); s = string; xx = x; while ( *s ) { if ( !noColorEscape && Q_IsColorString( s ) ) { s += 2; continue; } SCR_DrawChar( xx+2, y+2, size, *s ); xx += size; s++; } // draw the colored text s = string; xx = x; re.SetColor( setColor ); while ( *s ) { if ( !noColorEscape && Q_IsColorString( s ) ) { if ( !forceColor ) { Com_Memcpy( color, ColorForIndex(ColorIndex(*(s+1))), sizeof( color ) ); color[3] = setColor[3]; re.SetColor( color ); } s += 2; continue; } SCR_DrawChar( xx, y, size, *s ); xx += size; s++; } re.SetColor( NULL ); }
void SCR_DrawCondensedString( int x, int y, float size, const char *string, float *setColor, qboolean forceColor ) { vec4_t color; const char *s; int xx; // draw the drop shadow color[0] = color[1] = color[2] = 0; color[3] = setColor[3]; re.SetColor( color ); s = string; xx = x; while ( *s ) { if ( Q_IsColorString( s ) ) { s += 2; continue; } SCR_DrawChar( xx+1, y+1, size, *s ); xx += size - (size / 8); s++; } // draw the colored text s = string; xx = x; re.SetColor( setColor ); while ( *s ) { if ( Q_IsColorString( s ) ) { if ( !forceColor ) { Com_Memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) ); color[3] = setColor[3]; re.SetColor( color ); } s += 2; continue; } SCR_DrawChar( xx, y, size, *s ); xx += size - (size / 8); s++; } re.SetColor( NULL ); }
/* ================== SCR_DrawBigString[Color] Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. Coordinates are at 640 by 480 virtual resolution ================== */ void SCR_DrawStringExt( int x, int y, float size, const char *string, qboolean forceColor, qboolean noColorEscape ) { const char *s; int xx; // draw the drop shadow re.SetColor(colorBlack); s = string; xx = x + 1; while (*s) { if ( Q_IsColorString( s ) ) { s += 2; continue; } SCR_DrawChar( xx, y+2, size, *s ); xx += size; s++; } // draw the colored text s = string; xx = x; re.SetColor( colorWhite ); while ( *s ) { if ( Q_IsColorString( s ) ) { if ( !forceColor ) { re.SetColor(ColorFromChar(s[1])); } s += 2; continue; } SCR_DrawChar( xx, y, size, *s ); xx += size; s++; } re.SetColor( NULL ); }
/* ============= Menu_DrawTextBox ============= */ void Menu_DrawTextBox (int x, int y, int width, int lines) { int cx, cy; int n; // draw left side cx = x; cy = y; SCR_DrawChar (cx, cy, ALIGN_CENTER, 1, 255,255,255,255, false, false); for (n = 0; n < lines; n++) { cy += MENU_FONT_SIZE; SCR_DrawChar (cx, cy, ALIGN_CENTER, 4, 255,255,255,255, false, false); } SCR_DrawChar (cx, cy+MENU_FONT_SIZE, ALIGN_CENTER, 7, 255,255,255,255, false, false); // draw middle cx += MENU_FONT_SIZE; while (width > 0) { cy = y; SCR_DrawChar (cx, cy, ALIGN_CENTER, 2, 255,255,255,255, false, false); for (n = 0; n < lines; n++) { cy += MENU_FONT_SIZE; SCR_DrawChar (cx, cy, ALIGN_CENTER, 5, 255,255,255,255, false, false); } SCR_DrawChar (cx, cy+MENU_FONT_SIZE, ALIGN_CENTER, 8, 255,255,255,255, false, false); width -= 1; cx += MENU_FONT_SIZE; } // draw right side cy = y; SCR_DrawChar (cx, cy, ALIGN_CENTER, 3, 255,255,255,255, false, false); for (n = 0; n < lines; n++) { cy += MENU_FONT_SIZE; SCR_DrawChar (cx, cy, ALIGN_CENTER, 6, 255,255,255,255, false, false); } SCR_DrawChar (cx, cy+MENU_FONT_SIZE, ALIGN_CENTER, 9, 255,255,255,255, false, true); }
void Field_Draw (menufield_s *f) { int i, alpha = mouseOverAlpha(&f->generic), xtra; char tempbuffer[128]=""; int offset; if (f->generic.name) Menu_DrawStringR2LDark (f->generic.x + f->generic.parent->x + LCOLUMN_OFFSET, f->generic.y + f->generic.parent->y, f->generic.name, 255); if (xtra = stringLengthExtra(f->buffer)) { strncpy( tempbuffer, f->buffer + f->visible_offset, f->visible_length ); offset = strlen(tempbuffer) - xtra; if (offset > f->visible_length) { f->visible_offset = offset - f->visible_length; strncpy( tempbuffer, f->buffer + f->visible_offset - xtra, f->visible_length + xtra ); offset = f->visible_offset; } } else { strncpy( tempbuffer, f->buffer + f->visible_offset, f->visible_length ); offset = strlen(tempbuffer); } SCR_DrawChar (f->generic.x + f->generic.parent->x + MENU_FONT_SIZE*2, f->generic.y + f->generic.parent->y - 4, ALIGN_CENTER, 18, 255,255,255,255, false, false); SCR_DrawChar (f->generic.x + f->generic.parent->x + MENU_FONT_SIZE*2, f->generic.y + f->generic.parent->y + 4, ALIGN_CENTER, 24, 255,255,255,255, false, false); SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+f->visible_length)*MENU_FONT_SIZE, f->generic.y + f->generic.parent->y - 4, ALIGN_CENTER, 20,255,255,255,255, false, false); SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+f->visible_length)*MENU_FONT_SIZE, f->generic.y + f->generic.parent->y + 4, ALIGN_CENTER, 26, 255,255,255,255, false, false); for (i = 0; i < f->visible_length; i++) { SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+i)*MENU_FONT_SIZE, f->generic.y + f->generic.parent->y - 4, ALIGN_CENTER, 19, 255,255,255,255, false, false); SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+i)*MENU_FONT_SIZE, f->generic.y + f->generic.parent->y + 4, ALIGN_CENTER, 25, 255,255,255,255, false, (i==(f->visible_length-1))); } // add cursor thingie if ( Menu_ItemAtCursor(f->generic.parent)==f && ((int)(Sys_Milliseconds()/250))&1 ) Com_sprintf(tempbuffer, sizeof(tempbuffer), "%s%c", tempbuffer, 11); Menu_DrawString (f->generic.x + f->generic.parent->x + MENU_FONT_SIZE*3, f->generic.y + f->generic.parent->y, tempbuffer, alpha); }
static void KeysBackCursorDrawFunc ( menuaction_s *self ) // back action { /*SCR_DrawChar (SCREEN_WIDTH*0.5 - 24, s_keys_menu.y + self->generic.y, ALIGN_CENTER, 12+((int)(Sys_Milliseconds()/250)&1), 255,255,255,255, false, true);*/ SCR_DrawChar (SCREEN_WIDTH*0.5 - 24+ (5*sin(anglemod(cl.time*0.01))), s_keys_menu.y + self->generic.y, ALIGN_CENTER, 13, 255,255,255,255, false, true); /* R_DrawChar (SCR_ScaledVideo(SCREEN_WIDTH*0.5 - 24), //viddef.width * 0.50 - SCR_ScaledVideo(24), SCR_ScaledVideo(s_keys_menu.y + self->generic.y), 12 + ( ( int ) ( Sys_Milliseconds() / 250 ) & 1), SCR_VideoScale(), 255,255,255,255, false, true);*/ }
/* ========================== Menu_Draw ========================== */ void Menu_Draw (menuframework_s *menu) { int i; menucommon_s *item; // // draw contents // for (i = 0; i < menu->nitems; i++) { // skip hidden items if ( ((menucommon_s *)menu->items[i])->flags & QMF_HIDDEN ) continue; switch ( ((menucommon_s *)menu->items[i])->type ) { case MTYPE_FIELD: Field_Draw( ( menufield_s * )menu->items[i] ); break; case MTYPE_SLIDER: Slider_Draw( (menuslider_s *)menu->items[i] ); break; case MTYPE_LIST: MenuList_Draw( (menulist_s *)menu->items[i] ); break; case MTYPE_SPINCONTROL: SpinControl_Draw( (menulist_s *)menu->items[i] ); break; case MTYPE_ACTION: Action_Draw( (menuaction_s *)menu->items[i] ); break; case MTYPE_SEPARATOR: Separator_Draw( (menuseparator_s *)menu->items[i] ); break; } } // added Psychspaz's mouse support // // now check mouseovers - psychospaz // cursor.menu = menu; if (cursor.mouseaction) { menucommon_s *lastitem = cursor.menuitem; UI_RefreshCursorLink(); for (i = menu->nitems; i >= 0 ; i--) { int type, len; int min[2], max[2]; float x1, y1, w1, h1; item = ((menucommon_s * )menu->items[i]); if (!item || item->type == MTYPE_SEPARATOR) continue; x1 = menu->x + item->x + RCOLUMN_OFFSET; // + 2 chars for space + cursor y1 = menu->y + item->y; w1 = 0; h1 = MENU_FONT_SIZE; SCR_AdjustFrom640 (&x1, &y1, &w1, &h1, ALIGN_CENTER); min[0] = x1; max[0] = x1+w1; min[1] = y1; max[1] = y1+h1; // max[0] = min[0] = SCR_ScaledVideo(menu->x + item->x + RCOLUMN_OFFSET); //+ 2 chars for space + cursor // max[1] = min[1] = SCR_ScaledVideo(menu->y + item->y); // max[1] += SCR_ScaledVideo(MENU_FONT_SIZE); switch (item->type) { case MTYPE_ACTION: { len = strlen(item->name); if (item->flags & QMF_LEFT_JUSTIFY) { min[0] += SCR_ScaledVideo(LCOLUMN_OFFSET*2); max[0] = min[0] + SCR_ScaledVideo(len*MENU_FONT_SIZE); } else min[0] -= SCR_ScaledVideo(len*MENU_FONT_SIZE + MENU_FONT_SIZE*3); type = MENUITEM_ACTION; } break; case MTYPE_SLIDER: { if (item->name) { len = strlen(item->name); min[0] -= SCR_ScaledVideo(len*MENU_FONT_SIZE - LCOLUMN_OFFSET*2); } else min[0] -= SCR_ScaledVideo(16); max[0] += SCR_ScaledVideo((SLIDER_RANGE + 4)*MENU_FONT_SIZE); type = MENUITEM_SLIDER; } break; case MTYPE_LIST: case MTYPE_SPINCONTROL: { int len; menulist_s *spin = menu->items[i]; if (item->name) { len = strlen(item->name); min[0] -= SCR_ScaledVideo(len*MENU_FONT_SIZE - LCOLUMN_OFFSET*2); } len = strlen(spin->itemnames[spin->curvalue]); max[0] += SCR_ScaledVideo(len*MENU_FONT_SIZE); type = MENUITEM_ROTATE; } break; case MTYPE_FIELD: { menufield_s *text = menu->items[i]; len = text->visible_length + 2; max[0] += SCR_ScaledVideo(len*MENU_FONT_SIZE); type = MENUITEM_TEXT; } break; default: continue; } if (cursor.x>=min[0] && cursor.x<=max[0] && cursor.y>=min[1] && cursor.y<=max[1]) { // new item if (lastitem!=item) { int j; for (j=0; j<MENU_CURSOR_BUTTON_MAX; j++) { cursor.buttonclicks[j] = 0; cursor.buttontime[j] = 0; } } cursor.menuitem = item; cursor.menuitemtype = type; menu->cursor = i; break; } } } cursor.mouseaction = false; // end mouseover code item = Menu_ItemAtCursor(menu); if (item && item->cursordraw) { item->cursordraw(item); } else if (menu->cursordraw) { menu->cursordraw(menu); } else if (item && item->type != MTYPE_FIELD) { if (item->flags & QMF_LEFT_JUSTIFY) { SCR_DrawChar (menu->x+item->x+item->cursor_offset-24, menu->y+item->y, ALIGN_CENTER, 12+((int)(Sys_Milliseconds()/250)&1), 255,255,255,255, false, true); } else { SCR_DrawChar (menu->x+item->cursor_offset, menu->y+item->y, ALIGN_CENTER, 12+((int)(Sys_Milliseconds()/250)&1), 255,255,255,255, false, true); } } if (item) { if (item->statusbarfunc) item->statusbarfunc ( (void *)item ); else if (item->statusbar) Menu_DrawStatusBar (item->statusbar); else Menu_DrawStatusBar (menu->statusbar); } else Menu_DrawStatusBar( menu->statusbar ); }
/* ================== SCR_DrawBigString[Color] Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color. ================== */ void SCR_DrawStringExt(int x, int y, float w, float h, const char *string, float *setColor, qboolean forceColor, qboolean noColorEscape, qboolean dropShadow, qboolean nativeResolution) { vec4_t color; const char *s; int xx; if (dropShadow) { // draw the drop shadow Vector4Copy(colorBlack, color); color[3] = setColor[3]; re.SetColor(color); s = string; xx = x; while (*s) { if (!noColorEscape && Q_IsColorString(s)) { s += 2; continue; } SCR_DrawChar(xx + 2, y + 2, w, h, Q_UTF8_CodePoint(s), nativeResolution); xx += w; s += Q_UTF8_Width(s); } } // draw the colored text s = string; xx = x; re.SetColor(setColor); while (*s) { if (Q_IsColorString(s)) { if (!forceColor) { if (*(s + 1) == COLOR_NULL) { memcpy(color, setColor, sizeof(color)); } else { memcpy(color, g_color_table[ColorIndex(*(s + 1))], sizeof(color)); color[3] = setColor[3]; } color[3] = setColor[3]; re.SetColor(color); } if (!noColorEscape) { s += 2; continue; } } SCR_DrawChar(xx, y, w, h, Q_UTF8_CodePoint(s), nativeResolution); xx += w; s += Q_UTF8_Width(s); } re.SetColor(NULL); }