这篇教程C++ trap_R_DrawStretchPic函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中trap_R_DrawStretchPic函数的典型用法代码示例。如果您正苦于以下问题:C++ trap_R_DrawStretchPic函数的具体用法?C++ trap_R_DrawStretchPic怎么用?C++ trap_R_DrawStretchPic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了trap_R_DrawStretchPic函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: UI_DrawProportionalString2static void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, float sizeScale, qhandle_t charset ) { const char* s; unsigned char ch; float ax; float ay; float aw; float ah; float frow; float fcol; float fwidth; float fheight; // draw the colored text trap_R_SetColor( color ); ax = x * cgs.screenXScale + cgs.screenXBias; ay = y * cgs.screenYScale; s = str; while ( *s ) { ch = *s & 127; if ( ch == ' ' ) { aw = (float)PROP_SPACE_WIDTH * cgs.screenXScale * sizeScale; } else if ( propMap[ch][2] != -1 ) { fcol = (float)propMap[ch][0] / 256.0f; frow = (float)propMap[ch][1] / 256.0f; fwidth = (float)propMap[ch][2] / 256.0f; fheight = (float)PROP_HEIGHT / 256.0f; aw = (float)propMap[ch][2] * cgs.screenXScale * sizeScale; ah = (float)PROP_HEIGHT * cgs.screenYScale * sizeScale; trap_R_DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol + fwidth, frow + fheight, charset ); } else { aw = 0; } ax += ( aw + (float)PROP_GAP_WIDTH * cgs.screenXScale * sizeScale ); s++; } trap_R_SetColor( NULL );}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:42,
示例2: UI_DrawBannerString2/*=================UI_DrawBannerString=================*/static void UI_DrawBannerString2( int x, int y, const char* str, vec4_t color ){ const char* s; unsigned char ch; float ax; float ay; float aw; float ah; float frow; float fcol; float fwidth; float fheight; // draw the colored text trap_R_SetColor( color ); ax = x * uis.xscale + uis.bias; ay = y * uis.yscale; s = str; while ( *s ) { ch = *s & 127; if ( ch == ' ' ) { ax += ((float)PROPB_SPACE_WIDTH + (float)PROPB_GAP_WIDTH)* uis.xscale; } else if ( ch >= 'A' && ch <= 'Z' ) { ch -= 'A'; fcol = (float)propMapB[ch][0] / 256.0f; frow = (float)propMapB[ch][1] / 256.0f; fwidth = (float)propMapB[ch][2] / 256.0f; fheight = (float)PROPB_HEIGHT / 256.0f; aw = (float)propMapB[ch][2] * uis.xscale; ah = (float)PROPB_HEIGHT * uis.yscale; trap_R_DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol+fwidth, frow+fheight, uis.charsetPropB ); ax += (aw + (float)PROPB_GAP_WIDTH * uis.xscale); } s++; } trap_R_SetColor( NULL );}
开发者ID:TimeDoctor,项目名称:ioq3,代码行数:47,
示例3: ExitMenu_Draw/*#######################ExitMenu_Draw#######################*/static void ExitMenu_Draw(void){ float x,y,w,h,scale; scale=(float)(uis.realtime-exitmenu.starttime)*0.003f;//0.001f; if(scale>1.0f) scale=1.0f; else if(scale<0.0f) scale=0.0f; //mitte: 320/209 w=310.0f*scale; h=110.0f*scale; x=320.0f-w*0.5f; y=209.0f-h*0.5f; UI_AdjustFrom640(&x,&y,&w,&h); trap_R_DrawStretchPic(x,y,w,h,0,0,1,1,exitmenu.theexit); Menu_Draw( &exitmenu.menu );}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:25,
示例4: SCR_DrawPlayerIcons/** SCR_DrawPlayerIcons*/static void SCR_DrawPlayerIcons( struct qfontface_s *font ){ if( !scr_numplayericons ) return; qsort( scr_playericons, scr_numplayericons, sizeof( scr_playericons[0] ), ( int (*)( const void *, const void * ) )SCR_ComparePlayerIcons ); int height = trap_SCR_FontHeight( font ); vec4_t color; Vector4Copy( colorWhite, color ); for( unsigned i = 0; i < scr_numplayericons; i++ ) { scr_playericon_t &icon = scr_playericons[i]; color[3] = icon.alpha; trap_R_DrawStretchPic( icon.x, icon.y, height, height, 0, 0, 1, 1, color, icon.image ); } scr_numplayericons = 0;}
开发者ID:DenMSC,项目名称:racemod_2.1,代码行数:24,
示例5: CG_DrawSkillBarstatic void CG_DrawSkillBar(float x, float y, float w, float h, int skill){ int i; float blockheight = (h - 4) / (float)(NUM_SKILL_LEVELS - 1); float draw_y = y + h - blockheight; vec4_t colour; float x1, y1, w1, h1; for (i = 0; i < NUM_SKILL_LEVELS - 1; i++) { if (i >= skill) { Vector4Set(colour, 1.f, 1.f, 1.f, .15f); } else { Vector4Set(colour, 0.f, 0.f, 0.f, .4f); } CG_FillRect(x, draw_y, w, blockheight, colour); if (i < skill) { x1 = x; y1 = draw_y; w1 = w; h1 = blockheight; CG_AdjustFrom640(&x1, &y1, &w1, &h1); trap_R_DrawStretchPic(x1, y1, w1, h1, 0, 0, 1.f, 0.5f, cgs.media.limboStar_roll); } CG_DrawRect_FixedBorder(x, draw_y, w, blockheight, 1, colorBlack); draw_y -= (blockheight + 1); }}
开发者ID:sxweet,项目名称:etlegacy,代码行数:36,
示例6: CG_DrawArmor/*================CG_DrawArmor================*/static void CG_DrawArmor( menuDef_t *menuHUD ){ //vec4_t calcColor; vec4_t glowColor; playerState_t *ps; int armor, maxArmor; itemDef_t *focusItem; double percentage, factor ; //quarterArmor; //int i,currValue,inc; const char *text; int x; static double fcurrent = 0; vec4_t fadecolor = {1, 1, 1, 0.5f}; static vec4_t draincolor = {1, 0.4f, 0.4f, 1}; static vec4_t fillcolor = {0.4f, 1, 0.4f, 1}; vec4_t opacity; int state = 0; MAKERGBA(opacity, 1, 1, 1, cg.jkg_HUDOpacity); //ps = &cg.snap->ps; ps = &cg.predictedPlayerState; // Can we find the menu? if (!menuHUD) { return; } armor = ps->stats[STAT_ARMOR]; maxArmor = ps->stats[STAT_MAX_ARMOR]; // TEST: just render the whole thing for now, we'll fix it later focusItem = Menu_FindItemByName(menuHUD, "shieldbar"); if (focusItem) { percentage = (double)armor / (double)maxArmor; if (percentage > 1) { percentage = 1; } else if (percentage < 0) { percentage = 0; } factor = /*0.6171875f **/ percentage /*+ 0.34375f*/; /*if(factor > 0.95f) { factor = 1.0f; //eezstreet - mega hack }*/ // Fade our fcurrent to this factor if (fcurrent < factor) { // Raise it fcurrent += (cg.frameDelta * .0003); // Go up 30% per second if (fcurrent > factor) { // We passed it fcurrent = factor; } } else if (fcurrent > factor) { // Lower it fcurrent -= (cg.frameDelta * .0003); // Go up 30% per second if (fcurrent < factor) { fcurrent = factor; } } if (fcurrent != 0) { if (fcurrent < factor) { state = 1; // We're filling up, draw up to fcurrent solid, and up to factor translucent trap_R_SetColor(opacity); trap_R_DrawStretchPic(focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w * fcurrent, focusItem->window.rect.h, 0, 0, fcurrent, 1, focusItem->window.background); fadecolor[3] *= cg.jkg_HUDOpacity; trap_R_SetColor(fadecolor); trap_R_DrawStretchPic(focusItem->window.rect.x + focusItem->window.rect.w * fcurrent, focusItem->window.rect.y, focusItem->window.rect.w * (factor - fcurrent), focusItem->window.rect.h, fcurrent, 0, factor, 1, focusItem->window.background); trap_R_SetColor(opacity); } else if (fcurrent > factor) { state = 2; // We're draining, draw up to factor solid, and up to fcurrent translucent trap_R_DrawStretchPic(focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w * factor, focusItem->window.rect.h, 0, 0, factor, 1, focusItem->window.background); fadecolor[3] *= cg.jkg_HUDOpacity; trap_R_SetColor(fadecolor); trap_R_DrawStretchPic(focusItem->window.rect.x + focusItem->window.rect.w * factor, focusItem->window.rect.y, focusItem->window.rect.w * (fcurrent - factor), focusItem->window.rect.h, factor, 0, fcurrent, 1, focusItem->window.background); trap_R_SetColor(opacity); } else { state = 0; // Just solid trap_R_SetColor(opacity); trap_R_DrawStretchPic(focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w * factor, focusItem->window.rect.h, 0, 0, factor, 1, focusItem->window.background); } } }//.........这里部分代码省略.........
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:101,
示例7: CG_DrawPic/*================CG_DrawPicCoordinates are 640*480 virtual values=================*/void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader ){ CG_AdjustFrom640( &x, &y, &width, &height ); trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );}
开发者ID:SHOVELL,项目名称:Unvanquished,代码行数:12,
示例8: SCB_DrawPlayerStats/** SCB_DrawPlayerStats*/static int SCB_DrawPlayerStats( int x, int y, struct qfontface_s *font ){ int xoffset, yoffset, lines; int i, j, num_weapons, weap, xpos, width, done; gsitem_t *it; char string[MAX_STRING_CHARS]; vec4_t color = { 0.5, 0.5, 0.5, 0.5f }; // don't display stats if( !cg_scoreboardStats->integer ) return 0; // total number of weapon num_weapons = WEAP_TOTAL-WEAP_GUNBLADE; width = ( SCB_TINYFIELD_PIXELWIDTH + 2 * SCB_SMALLFIELD_PIXELWIDTH ) * 2 + SCB_SMALLFIELD_PIXELWIDTH; xpos = -width / 2; // Center the box xoffset = xpos; yoffset = trap_SCR_FontHeight( font ); // Room for header, it's actually written later if we have at least one stat yoffset += trap_SCR_FontHeight( font ); lines = 0; for( i = 0; i < num_weapons; ) { xoffset = xpos; // two weapons per line for( j = 0, done = 0; done < 2 && i + j < num_weapons; j++ ) { weap = WEAP_GUNBLADE + i + j; if( scb_player_stats[2*( i+j )] == -1 && scb_player_stats[2*( i+j )+1] == -1 ) continue; it = GS_FindItemByTag( weap ); // short name Q_snprintfz( string, sizeof( string ), "%s%2s", it->color, it->shortname ); trap_SCR_DrawStringWidth( x + xoffset, y + yoffset, ALIGN_LEFT_TOP, string, SCB_TINYFIELD_PIXELWIDTH, font, colorWhite ); Q_snprintfz( string, sizeof( string ), "%2d%c", scb_player_stats[2*( i+j )+1], '%' ); trap_SCR_DrawStringWidth( x + xoffset + 2 * SCB_TINYFIELD_PIXELWIDTH, y + yoffset, ALIGN_CENTER_TOP, string, 2*SCB_SMALLFIELD_PIXELWIDTH, font, colorWhite ); // separator xoffset = 0; done++; } // next line if( done > 0 ) { lines++; yoffset += trap_SCR_FontHeight( font ); } i += j; } if( lines ) { // if we drew anything, draw header and box too xoffset = xpos; yoffset = trap_SCR_FontHeight( font ); // header trap_SCR_DrawStringWidth( x + xoffset, y + yoffset, ALIGN_LEFT_TOP, CG_TranslateString( "Weapon stats" ), width, font, colorMdGrey ); yoffset += trap_SCR_FontHeight( font ); // box trap_R_DrawStretchPic( x + xoffset - SCB_TINYFIELD_PIXELWIDTH/2, y + yoffset, width + SCB_TINYFIELD_PIXELWIDTH, lines * trap_SCR_FontHeight( font ), 0, 0, 1, 1, color, cgs.shaderWhite ); return ( trap_SCR_FontHeight( font ) * ( 2+lines ) ); } return 0;}
开发者ID:DenMSC,项目名称:racemod_2.1,代码行数:86,
示例9: CG_DrawBeaconstatic void CG_DrawBeacon( cbeacon_t *b ){ float angle; // Don't draw clamped beacons for tags, except for enemy players. if( b->type == BCT_TAG && b->clamped && !( ( b->flags & EF_BC_ENEMY ) && ( b->flags & EF_BC_TAG_PLAYER ) ) ) return; Color::Color color = b->color; if( !( BG_Beacon( b->type )->flags & BCF_IMPORTANT ) ) color.SetAlpha( color.Alpha() * cgs.bc.hudAlpha ); else color.SetAlpha( color.Alpha() * cgs.bc.hudAlphaImportant ); trap_R_SetColor( color ); trap_R_DrawStretchPic( b->pos[ 0 ] - b->size/2, b->pos[ 1 ] - b->size/2, b->size, b->size, 0, 0, 1, 1, CG_BeaconIcon( b ) ); if( b->flags & EF_BC_DYING ) trap_R_DrawStretchPic( b->pos[ 0 ] - b->size/2 * 1.3, b->pos[ 1 ] - b->size/2 * 1.3, b->size * 1.3, b->size * 1.3, 0, 0, 1, 1, cgs.media.beaconNoTarget ); if ( b->clamped ) trap_R_DrawRotatedPic( b->pos[ 0 ] - b->size/2 * 1.5, b->pos[ 1 ] - b->size/2 * 1.5, b->size * 1.5, b->size * 1.5, 0, 0, 1, 1, cgs.media.beaconIconArrow, 270.0 - ( angle = atan2( b->clamp_dir[ 1 ], b->clamp_dir[ 0 ] ) ) * 180 / M_PI ); if( b->type == BCT_TIMER ) { int num; num = ( BEACON_TIMER_TIME + b->ctime - cg.time ) / 100; if( num > 0 ) { float h, tw; const char *p; vec2_t pos, dir, rect[ 2 ]; int i, l, frame; h = b->size * 0.4; p = va( "%d", num ); l = strlen( p ); tw = h * l; if( !b->clamped ) { pos[ 0 ] = b->pos[ 0 ]; pos[ 1 ] = b->pos[ 1 ] + b->size/2 + h/2; } else { rect[ 0 ][ 0 ] = b->pos[ 0 ] - b->size/2 - tw/2; rect[ 1 ][ 0 ] = b->pos[ 0 ] + b->size/2 + tw/2; rect[ 0 ][ 1 ] = b->pos[ 1 ] - b->size/2 - h/2; rect[ 1 ][ 1 ] = b->pos[ 1 ] + b->size/2 + h/2; for( i = 0; i < 2; i++ ) dir[ i ] = - b->clamp_dir[ i ]; ProjectPointOntoRectangleOutwards( pos, b->pos, dir, (const vec2_t*)rect ); } pos[ 0 ] -= tw/2; pos[ 1 ] -= h/2; for( i = 0; i < l; i++ ) { if( p[ i ] >= '0' && p[ i ] <= '9' ) frame = p[ i ] - '0'; else if( p[ i ] == '-' ) frame = STAT_MINUS; else frame = -1; if( frame != -1 ) trap_R_DrawStretchPic( pos[ 0 ], pos[ 1 ], h, h, 0, 0, 1, 1, cgs.media.numberShaders[ frame ] ); pos[ 0 ] += h; } } } trap_R_ClearColor();}
开发者ID:t4im,项目名称:Unvanquished,代码行数:97,
示例10: CG_PainBlend/*===============CG_PainBlend===============*/static void CG_PainBlend(){ int damage; float damageAsFracOfMax; qhandle_t shader = cgs.media.viewBloodShader; float x, y, w, h; float s1, t1, s2, t2; if ( cg.snap->ps.persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT || cg.intermissionStarted ) { return; } damage = cg.lastHealth - cg.snap->ps.stats[ STAT_HEALTH ]; if ( damage < 0 ) { damage = 0; } damageAsFracOfMax = ( float ) damage / cg.snap->ps.stats[ STAT_MAX_HEALTH ]; cg.lastHealth = cg.snap->ps.stats[ STAT_HEALTH ]; cg.painBlendValue += damageAsFracOfMax * cg_painBlendScale.value; if ( cg.painBlendValue > 0.0f ) { cg.painBlendValue -= ( cg.frametime / 1000.0f ) * cg_painBlendDownRate.value; } if ( cg.painBlendValue > 1.0f ) { cg.painBlendValue = 1.0f; } else if ( cg.painBlendValue <= 0.0f ) { cg.painBlendValue = 0.0f; return; } Color::Color color; if ( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_ALIENS ) { color = { 0.43f, 0.8f, 0.37f }; } else if ( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_HUMANS ) { color = { 0.8f, 0.0f, 0.0f }; } if ( cg.painBlendValue > cg.painBlendTarget ) { cg.painBlendTarget += ( cg.frametime / 1000.0f ) * cg_painBlendUpRate.value; } else if ( cg.painBlendValue < cg.painBlendTarget ) { cg.painBlendTarget = cg.painBlendValue; } if ( cg.painBlendTarget > cg_painBlendMax.value ) { cg.painBlendTarget = cg_painBlendMax.value; } color.SetAlpha( cg.painBlendTarget ); trap_R_SetColor( color ); //left x = 0.0f; y = 0.0f; w = PAINBLEND_BORDER * 640.0f; h = 480.0f; CG_AdjustFrom640( &x, &y, &w, &h ); s1 = 0.0f; t1 = 0.0f; s2 = PAINBLEND_BORDER; t2 = 1.0f; CG_ScalePainBlendTCs( &s1, &t1, &s2, &t2 ); trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, shader ); //right x = 640.0f - ( PAINBLEND_BORDER * 640.0f ); y = 0.0f; w = PAINBLEND_BORDER * 640.0f; h = 480.0f; CG_AdjustFrom640( &x, &y, &w, &h ); s1 = 1.0f - PAINBLEND_BORDER; t1 = 0.0f; s2 = 1.0f; t2 = 1.0f; CG_ScalePainBlendTCs( &s1, &t1, &s2, &t2 ); trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, shader );//.........这里部分代码省略.........
开发者ID:t4im,项目名称:Unvanquished,代码行数:101,
示例11: UI_DrawNamedPicvoid UI_DrawNamedPic( float x, float y, float width, float height, const char *picname ) { qhandle_t hShader; hShader = trap_R_RegisterShaderNoMip( picname ); trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );}
开发者ID:deathsythe47,项目名称:jaMME,代码行数:6,
示例12: CG_DrawChat/*** CG_DrawChat*/void CG_DrawChat( cg_gamechat_t *chat, int x, int y, char *fontName, struct qfontface_s *font, int fontSize, int width, int height, int padding_x, int padding_y, vec4_t backColor, struct shader_s *backShader ) { int i, j; int s, e, w; int utf_len; int l, total_lines, lines; int x_offset, y_offset; int font_height; int pass; int lastcolor; int message_mode; int wait_time, fade_time; const cg_gamemessage_t *msg; const char *text; char tstr[GAMECHAT_STRING_SIZE]; vec4_t fontColor; bool chat_active = false; bool background_drawn = false; int corner_radius = 12 * cgs.vidHeight / 600; int background_y; int first_candidate; font_height = trap_SCR_FontHeight( font ); message_mode = (int)trap_Cvar_Value( "con_messageMode" ); chat_active = ( chat->lastMsgTime + GAMECHAT_WAIT_IN_TIME + GAMECHAT_FADE_IN_TIME > cg.realTime || message_mode ); lines = 0; total_lines = /*!message_mode ? 0 : */ 1; if( chat_active ) { wait_time = GAMECHAT_WAIT_IN_TIME; fade_time = GAMECHAT_FADE_IN_TIME; } else { wait_time = GAMECHAT_WAIT_OUT_TIME; fade_time = GAMECHAT_FADE_OUT_TIME; } if( chat_active != chat->lastActive ) { // smooth fade ins and fade outs chat->lastActiveChangeTime = cg.realTime - ( 1.0 - chat->activeFrac ) * ( wait_time + fade_time ); } if( cg.realTime >= chat->lastActiveChangeTime + wait_time ) { int time_diff, time_interval; time_diff = cg.realTime - ( chat->lastActiveChangeTime + wait_time ); time_interval = fade_time; if( time_diff <= time_interval ) { chat->activeFrac = (float)time_diff / time_interval; } else { chat->activeFrac = 1; } } else { chat->activeFrac = 0; } if( chat_active ) { backColor[3] *= chat->activeFrac; } else { backColor[3] *= ( 1.0 - chat->activeFrac ); } for( i = 0; i < GAMECHAT_STACK_SIZE; i++ ) { bool old_msg; l = chat->nextMsg - 1 - i; if( l < 0 ) { l = GAMECHAT_STACK_SIZE + l; } msg = &chat->messages[l]; text = msg->text; old_msg = !message_mode && ( cg.realTime > msg->time + GAMECHAT_NOTIFY_TIME ); if( !background_drawn && backColor[3] ) { if( old_msg ) { // keep the box being drawn for a while to prevent it from flickering // upon arrival of the possibly entered chat message if( !( !chat_active && cg.realTime <= chat->lastActiveChangeTime + 200 ) ) { break; } } background_y = y; trap_R_DrawStretchPic( x, background_y, width, height - corner_radius, 0.0f, 0.0f, 1.0f, 0.5f, backColor, backShader ); background_y += height - corner_radius; if( trap_IN_IME_GetCandidates( NULL, 0, 10, NULL, &first_candidate ) ) { int candidates_height = ( first_candidate ? 3 : 5 ) * font_height; trap_R_DrawStretchPic( x, background_y, width, candidates_height, 0.0f, 0.5f, 1.0f, 0.5f, backColor, backShader ); background_y += candidates_height; } trap_R_DrawStretchPic( x, background_y, corner_radius, corner_radius, 0.0f, 0.5f, 0.5f, 1.0f, backColor, backShader );//.........这里部分代码省略.........
开发者ID:Picmip,项目名称:qfusion,代码行数:101,
示例13: CG_DrawTopBottomvoid CG_DrawTopBottom(float x, float y, float w, float h, float size) { size *= cgs.screenYScale; trap_R_DrawStretchPic( x, y, w, size, 0, 0, 0, 0, cgs.media.whiteShader ); trap_R_DrawStretchPic( x, y + h - size, w, size, 0, 0, 0, 0, cgs.media.whiteShader );}
开发者ID:blaenk,项目名称:jedioutcast,代码行数:5,
示例14: CG_DrawTopBottom_NoScalevoid CG_DrawTopBottom_NoScale( float x, float y, float w, float h, float size ) { CG_AdjustFrom640( &x, &y, &w, &h ); trap_R_DrawStretchPic( x, y, w, size, 0, 0, 0, 0, cgs.media.whiteShader ); trap_R_DrawStretchPic( x, y + h - size, w, size, 0, 0, 0, 0, cgs.media.whiteShader );}
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:5,
示例15: SCR_DrawPlayerTab//.........这里部分代码省略......... } if( i < 0 || i >= gs.maxclients ) Q_strncpyz( string, "invalid", sizeof( string ) ); else Q_strncpyz( string, cgs.clientInfo[i].name, sizeof( string ) ); if( ISVIEWERENTITY( i + 1 ) ) // highlight if it's our own player highlight = true; break; case 'i': // is a integer (negatives are colored in red) i = atoi( token ); Q_snprintfz( string, sizeof( string ), "%i", i ); VectorCopy( i >= 0 ? colorWhite : colorRed, color ); break; case 'f': // is a float Q_snprintfz( string, sizeof( string ), "%.2f", atof( token ) ); break; case 'l': // p is an integer colored in latency style i = atoi( token ); Q_snprintfz( string, sizeof( string ), "%i", i ); CG_PingColor( i, color ); break; case 'b': // is a Y/N boolean i = atoi( token ); Q_snprintfz( string, sizeof( string ), "%s", CG_TranslateString( ( i != 0 ) ? "Yes" : "No" ) ); VectorCopy( i ? colorGreen : colorRed, color ); break; case 'p': // is a picture. It uses height for width to get a square iconnum = atoi( token ); if( ( iconnum > 0 ) && ( iconnum < MAX_IMAGES ) ) icon = cgs.imagePrecache[iconnum]; break; case 't': // is a race time. Convert time into MM:SS:mm { unsigned int milli, min, sec; milli = (unsigned int)( atoi( token ) ); if( !milli ) Q_snprintfz( string, sizeof( string ), CG_TranslateString( "no time" ) ); else { min = milli / 60000; milli -= min * 60000; sec = milli / 1000; milli -= sec * 1000; Q_snprintfz( string, sizeof( string ), va( "%02i:%02i.%03i", min, sec, milli ) ); } } break; case 'r': // is a ready state tick that is hidden when not in warmup if( atoi( token ) ) icon = CG_MediaShader( cgs.media.shaderVSayIcon[VSAY_YES] ); break; } if( !width ) continue; // draw the column background teamcolor[3] = SCB_BACKGROUND_ALPHA; if( columncount & 1 ) teamcolor[3] -= 0.15; if( highlight ) teamcolor[3] += 0.3; if( trans ) color[3] = 0.3; if( !pass ) { trap_R_DrawStretchPic( x + xoffset, y + yoffset, width, height, 0, 0, 1, 1, teamcolor, cgs.shaderWhite ); if( icon ) SCR_AddPlayerIcon( icon, x + xoffset, y + yoffset, color[3], font ); } // draw the column value if( pass && string[0] ) { trap_SCR_DrawClampString( x + xoffset, y + yoffset, string, x + xoffset, y + yoffset, x + xoffset + width, y + yoffset + height, font, color ); } columncount++; xoffset += width; } yoffset += height; return yoffset;}
开发者ID:DenMSC,项目名称:racemod_2.1,代码行数:101,
示例16: CG_DrawPic/*================CG_DrawPicCoordinates are 640*480 virtual valuesA width of 0 will draw with the original image width=================*/void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader ) { trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );}
开发者ID:blaenk,项目名称:jedioutcast,代码行数:11,
示例17: CG_DrawHealth/*================CG_DrawHealth================*/static void CG_DrawHealth( menuDef_t *menuHUD ){ vec4_t glowColor; playerState_t *ps; int healthAmt, maxAmt; //int i,currValue,inc; double percentage, factor; itemDef_t *focusItem; const char *text; int x; static double fcurrent = 0; vec4_t fadecolor = {1, 1, 1, 0.5f}; static vec4_t draincolor = {1, 0.4f, 0.4f, 1}; static vec4_t fillcolor = {0.4f, 1, 0.4f, 1}; vec4_t opacity; int state = 0; MAKERGBA(opacity, 1, 1, 1, cg.jkg_HUDOpacity); // Can we find the menu? if (!menuHUD) { return; } ps = &cg.snap->ps; // What's the health? healthAmt = ps->stats[STAT_HEALTH]; maxAmt = ps->stats[STAT_MAX_HEALTH]; //if (healthAmt > ps->stats[STAT_MAX_HEALTH]) //{ // healthAmt = ps->stats[STAT_MAX_HEALTH]; //} focusItem = Menu_FindItemByName(menuHUD, "healthbar"); if (focusItem) { percentage = (double)healthAmt / (double)maxAmt; if (percentage > 1) { percentage = 1; } else if (percentage < 0) { percentage = 0; } factor = /*0.62109375f **/ percentage /*+ 0.330078125f*/; /*if(factor > 0.95f) { factor = 1.0f; //eezstreet - mega hack }*/ if (fcurrent < factor) { // Raise it fcurrent += (cg.frameDelta * .0003); // Go up 30% per second if (fcurrent > factor) { // We passed it fcurrent = factor; } } else if (fcurrent > factor) { // Lower it fcurrent -= (cg.frameDelta * .0003); // Go up 30% per second if (fcurrent < factor) { fcurrent = factor; } } else { //Stay the same } if (fcurrent != 0) { if (fcurrent < factor) { state = 1; // We're filling up, draw up to fcurrent solid, and up to factor translucent trap_R_SetColor(opacity); trap_R_DrawStretchPic(focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w * fcurrent, focusItem->window.rect.h, 0, 0, fcurrent, 1, focusItem->window.background); fadecolor[3] *= cg.jkg_HUDOpacity; trap_R_SetColor(fadecolor); trap_R_DrawStretchPic(focusItem->window.rect.x + focusItem->window.rect.w * fcurrent, focusItem->window.rect.y, focusItem->window.rect.w * (factor - fcurrent), focusItem->window.rect.h, fcurrent, 0, factor, 1, focusItem->window.background); trap_R_SetColor(NULL); } else if (fcurrent > factor) { state = 2; // We're draining, draw up to factor solid, and up to fcurrent translucent trap_R_SetColor(opacity); trap_R_DrawStretchPic(focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w * factor, focusItem->window.rect.h, 0, 0, factor, 1, focusItem->window.background); fadecolor[3] *= cg.jkg_HUDOpacity; trap_R_SetColor(fadecolor); trap_R_DrawStretchPic(focusItem->window.rect.x + focusItem->window.rect.w * factor, focusItem->window.rect.y, focusItem->window.rect.w * (fcurrent - factor), focusItem->window.rect.h, factor, 0, fcurrent, 1, focusItem->window.background); trap_R_SetColor(NULL); } else { state = 0; // Just solid trap_R_SetColor(opacity);//.........这里部分代码省略.........
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:101,
示例18: CG_DrawForcePower/*================CG_DrawForcePower================*/static void CG_DrawForcePower( menuDef_t *menuHUD ){ // This goes in the lower bar on the hud const int maxForcePower = 100; vec4_t calcColor; float percent; qboolean flash=qfalse; itemDef_t *focusItem; vec4_t opacity; MAKERGBA( opacity, 1, 1, 1, 1*cg.jkg_HUDOpacity ); if (!menuHUD) { return; } // Make the hud flash by setting forceHUDTotalFlashTime above cg.time if (cg.forceHUDTotalFlashTime > cg.time ) { flash = qtrue; if (cg.forceHUDNextFlashTime < cg.time) { cg.forceHUDNextFlashTime = cg.time + 400; trap_S_StartSound (NULL, 0, CHAN_LOCAL, cgs.media.noforceSound ); if (cg.forceHUDActive) { cg.forceHUDActive = qfalse; } else { cg.forceHUDActive = qtrue; } } } else // turn HUD back on if it had just finished flashing time. { cg.forceHUDNextFlashTime = 0; cg.forceHUDActive = qtrue; }// if (!cg.forceHUDActive)// {// return;// } if (flash) { MAKERGBA(calcColor, 1, 1, 1, 0.6f*cg.jkg_HUDOpacity); } else { MAKERGBA(calcColor, 1, 1, 1, 1*cg.jkg_HUDOpacity); } /*focusItem = Menu_FindItemByName(menuHUD, "bar2ico"); if (focusItem) { calcColor[3] *= cg.jkg_HUDOpacity; trap_R_SetColor( calcColor ); CG_DrawPic( focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w, focusItem->window.rect.h, trap_R_RegisterShader("gfx/jkghud/ico_stamina.png") // TODO: Precache this ); }*/ // Work out the bar now percent = (float)cg.predictedPlayerState.forcePower / (float)maxForcePower; //percent *= 0.75f; // Range of the bar is 0 to 0.75f focusItem = Menu_FindItemByName(menuHUD, "staminabar"); if (focusItem) { trap_R_SetColor( opacity ); trap_R_DrawStretchPic( focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w * percent, focusItem->window.rect.h, 0, 0, percent, 1, focusItem->window.background ); } { char *Force = va("%i / %i", cg.predictedPlayerState.forcePower, maxForcePower); trap_R_Font_DrawString( focusItem->window.rect.x + (focusItem->window.rect.w / 2) - (trap_R_Font_StrLenPixels(Force, 1, 0.4)/2),//.........这里部分代码省略.........
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:101,
示例19: CG_DrawHotkeyBarstatic void CG_DrawHotkeyBar ( menuDef_t *menuHUD, vec4_t opacity ){ itemDef_t *focusItem; int i; if (!menuHUD) { return; } focusItem = Menu_FindItemByName(menuHUD, "frame"); if (focusItem) { trap_R_SetColor(opacity); CG_DrawPic( focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w, focusItem->window.rect.h, focusItem->window.background ); } // Print background of the bars for (i=0; i<11; i++) { focusItem = Menu_FindItemByName(menuHUD, va("slot%i", i)); if (focusItem) { vec4_t col = {0.11f, 0.11f, 0.11f, 1.0f}; qhandle_t shader = cgs.media.whiteShader; //dummy col[3] *= cg.jkg_HUDOpacity; if ( i < MAX_ACI_SLOTS && cg.playerACI[i] >= 0 && cg.playerInventory[cg.playerACI[i]].id && cg.playerInventory[cg.playerACI[i]].id->itemID ) { int weapon, variation; if(cg.playerInventory[cg.playerACI[i]].id->itemType == ITEM_WEAPON) { if ( BG_GetWeaponByIndex (cg.playerInventory[cg.playerACI[i]].id->varID, &weapon, &variation) ) { const weaponInfo_t *weaponInfo = CG_WeaponInfo (weapon, variation); shader = weaponInfo->hudIcon; col[0] = 1.0f; col[1] = 1.0f; col[2] = 1.0f; /*trap_R_SetColor (colorTable[CT_MDGREY]); trap_R_DrawStretchPic(focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w, focusItem->window.rect.h, 0, 0, 1, 1, cgs.media.whiteShader);*/ if(i == cg.weaponSelect) { trap_R_SetColor (opacity); //TODO: precache me! trap_R_DrawStretchPic(focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w, focusItem->window.rect.h, 0, 0, 1, 1, trap_R_RegisterShaderNoMip("gfx/jkghud/aciselect")); } } } else { col[0] = 1.0f; col[1] = 1.0f; col[2] = 1.0f; shader = trap_R_RegisterShaderNoMip(cg.playerInventory[cg.playerACI[i]].id->itemIcon); } } if(shader != cgs.media.whiteShader) { trap_R_SetColor( col ); trap_R_DrawStretchPic(focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w, focusItem->window.rect.h, 0, 0, 1, 1, shader); } //CG_DrawRect(focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w, focusItem->window.rect.h, 1, colorWhite); } focusItem = Menu_FindItemByName(menuHUD, va("slotl%i", i)); if (focusItem) { trap_R_Font_DrawString(focusItem->window.rect.x, focusItem->window.rect.y, va("%i", i), opacity, cgDC.Assets.qhSmallFont, -1, 0.4f); } } focusItem = Menu_FindItemByName(menuHUD, "frame_overlay"); if(focusItem) { trap_R_SetColor(opacity); CG_DrawPic( focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w, focusItem->window.rect.h, focusItem->window.background ); }}
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:90,
示例20: UI_DrawTopBottomvoid UI_DrawTopBottom(float x, float y, float w, float h) { trap_R_DrawStretchPic( x, y, w, 1, 0, 0, 0, 0, uiInfo.uiDC.whiteShader ); trap_R_DrawStretchPic( x, y + h - 1, w, 1, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );}
开发者ID:deathsythe47,项目名称:jaMME,代码行数:4,
示例21: UI_DrawSidesvoid UI_DrawSides(float x, float y, float w, float h) { trap_R_DrawStretchPic( x, y, 1, h, 0, 0, 0, 0, uiInfo.uiDC.whiteShader ); trap_R_DrawStretchPic( x + w - 1, y, 1, h, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );}
开发者ID:deathsythe47,项目名称:jaMME,代码行数:4,
示例22: CG_FillRect2/*-------------------------CGC_FillRect2real coords-------------------------*/void CG_FillRect2( float x, float y, float width, float height, const float *color ) { trap_R_SetColor( color ); trap_R_DrawStretchPic( x, y, width, height, 0, 0, 0, 0, cgs.media.whiteShader); trap_R_SetColor( NULL );}
开发者ID:blaenk,项目名称:jedioutcast,代码行数:11,
示例23: CG_DrawMiniMap//.........这里部分代码省略......... // filter invalid ents if( entnum < 1 || entnum >= MAX_EDICTS ) continue; // retrieve the centity_t cent = &cg_entities[entnum]; isSelf = ( (unsigned)entnum == cg.predictedPlayerState.POVnum ); if( ( cent->current.type != ET_PLAYER ) && ( cent->current.type != ET_MINIMAP_ICON ) && !( cent->item ) ) continue; if( isSelf ) VectorCopy( cg.predictedPlayerState.pmove.origin, coords ); else VectorCopy( cent->current.origin, coords ); coords[0] = ( coords[0] + x_lefttop ) / map_div_w; coords[1] = ih - ( coords[1] + y_lefttop ) / map_div_h; coords[2] = ( coords[2] + (float)z_lefttop ) / (float)map_z; // is it a player? if( ( cent->current.type == ET_PLAYER ) ) { int box_size = (int)( 3.0 + coords[2] * 10.0 ); // check if we're allowed to see team members only (coaches, CA) if( cg.predictedPlayerState.stats[STAT_LAYOUTS] & STAT_LAYOUT_SPECTEAMONLY || (cg.predictedPlayerState.stats[STAT_REALTEAM] != TEAM_SPECTATOR && GS_TeamOnlyMinimap()) ) { if( cg.predictedPlayerState.stats[STAT_REALTEAM] != cent->current.team ) continue; } if( cent->current.team == TEAM_SPECTATOR ) { if( entnum != cg.view.POVent ) continue; VectorSet( tmp_col, 1, 1, 1 ); } else { CG_TeamColor( cent->current.team, tmp_col ); } // get color tmp_col[3] = bound( 0, color[3] + 0.3f, 1 ); CG_DrawHUDRect( x + (int)coords[0] -box_size/2, y + (int)coords[1] -box_size/2, ALIGN_LEFT_TOP, box_size, box_size, box_size, box_size, tmp_col, NULL ); // differentiate ourselves with an arrow if( isSelf ) { int thisX, thisY, thisSize; thisSize = max( box_size, 8 ); thisX = CG_VerticalAlignForHeight( x + (int)coords[0], ALIGN_CENTER_MIDDLE, thisSize ); thisY = CG_VerticalAlignForHeight( y + (int)coords[1] - thisSize, ALIGN_CENTER_MIDDLE, thisSize ); trap_R_DrawStretchPic( thisX, thisY, thisSize, thisSize, 0, 0, 1, 1, tmp_yellow_alpha, CG_MediaShader( cgs.media.shaderDownArrow ) ); } // do we want names too? if( draw_playernames == qtrue ) trap_SCR_DrawString( x + (int)coords[0] + 8, y + (int)coords[1] - 4, ALIGN_LEFT_TOP, COM_RemoveColorTokensExt( cgs.clientInfo[cent->current.number-1].name, qtrue ), cgs.fontSystemSmall, tmp_yellow_alpha ); } else if( cent->current.type == ET_MINIMAP_ICON ) { if( cent->ent.customShader ) { vec4_t tmp_this_color; int thisX, thisY, thisSize; thisSize = (float)cent->prev.frame + (float)( cent->current.frame - cent->prev.frame ) * cg.lerpfrac; if( thisSize <= 0 ) thisSize = 18; tmp_this_color[0] = (float)cent->ent.shaderRGBA[0] / 255.0f; tmp_this_color[1] = (float)cent->ent.shaderRGBA[1] / 255.0f; tmp_this_color[2] = (float)cent->ent.shaderRGBA[2] / 255.0f; tmp_this_color[3] = 1.0f; thisX = CG_VerticalAlignForHeight( x + coords[0], ALIGN_CENTER_MIDDLE, thisSize ); thisY = CG_VerticalAlignForHeight( y + coords[1], ALIGN_CENTER_MIDDLE, thisSize ); trap_R_DrawStretchPic( thisX, thisY, thisSize, thisSize, 0, 0, 1, 1, tmp_this_color, cent->ent.customShader ); } } else if( cent->item && cent->item->icon ) { // if ALIGN_CENTER_MIDDLE or something is used, images are fucked // so thats why they are set manually at the correct pos with -n CG_DrawHUDRect( x+(int)coords[0]-8, y+(int)coords[1]-8, ALIGN_LEFT_TOP, 15, 15, 1, 1, tmp_white_alpha, trap_R_RegisterPic( cent->item->icon ) ); if( draw_itemnames == qtrue ) trap_SCR_DrawString( x + (int)coords[0] + 16, y + (int)coords[1] - 8, ALIGN_LEFT_TOP, cent->item->shortname, cgs.fontSystemSmall, tmp_yellow_alpha ); } }}
开发者ID:Racenet,项目名称:racesow,代码行数:101,
示例24: CG_DrawSides/*================CG_DrawSidesCoords are virtual 640x480================*/void CG_DrawSides(float x, float y, float w, float h, float size) { size *= cgs.screenXScale; trap_R_DrawStretchPic( x, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader ); trap_R_DrawStretchPic( x + w - size, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader );}
开发者ID:blaenk,项目名称:jedioutcast,代码行数:12,
示例25: CG_DrawSides_NoScalevoid CG_DrawSides_NoScale( float x, float y, float w, float h, float size ) { CG_AdjustFrom640( &x, &y, &w, &h ); trap_R_DrawStretchPic( x, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader ); trap_R_DrawStretchPic( x + w - size, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader );}
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:5,
示例26: CG_DrawPicST/*================CG_DrawPicSTAllows passing of st co-ordsCoordinates are 640*480 virtual values=================*/void CG_DrawPicST( float x, float y, float width, float height, float s0, float t0, float s1, float t1, qhandle_t hShader ) { CG_AdjustFrom640( &x, &y, &width, &height ); trap_R_DrawStretchPic( x, y, width, height, s0, t0, s1, t1, hShader );}
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:13,
示例27: CG_DrawInformation/*====================CG_DrawInformationDraw all the status / pacifier stuff during level loading====================*/void CG_DrawInformation( void ) { const char *s; const char *info; const char *sysInfo; int y; int value; qhandle_t levelshot; qhandle_t detail; char buf[1024]; info = CG_ConfigString( CS_SERVERINFO ); sysInfo = CG_ConfigString( CS_SYSTEMINFO ); s = Info_ValueForKey( info, "mapname" ); levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s", s ) ); if ( !levelshot ) { levelshot = trap_R_RegisterShaderNoMip( "menu/art/unknownmap" ); } trap_R_SetColor( NULL ); trap_R_DrawStretchPic( 0, 0, cgs.glconfig.vidWidth, cgs.glconfig.vidHeight, 0, 0, 1, 1, levelshot ); // blend a detail texture over it detail = trap_R_RegisterShader( "levelShotDetail" ); trap_R_DrawStretchPic( 0, 0, cgs.glconfig.vidWidth, cgs.glconfig.vidHeight, 0, 0, 2.5, 2, detail ); // draw the icons of things as they are loaded CG_DrawLoadingIcons(); // the first 150 rows are reserved for the client connection // screen to write into if ( cg.infoScreenText[0] ) { UI_DrawProportionalString( 320, 128-32, va("Loading... %s", cg.infoScreenText), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); } else { UI_DrawProportionalString( 320, 128-32, "Awaiting snapshot...", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); } // draw info string information y = 180-32; // don't print server lines if playing a local game trap_Cvar_VariableStringBuffer( "sv_running", buf, sizeof( buf ) ); if ( !atoi( buf ) ) { // server hostname Q_strncpyz(buf, Info_ValueForKey( info, "sv_hostname" ), 1024); Q_CleanStr(buf); UI_DrawProportionalString( 320, y, buf, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT; // pure server s = Info_ValueForKey( sysInfo, "sv_pure" ); if ( s[0] == '1' ) { UI_DrawProportionalString( 320, y, "Pure Server", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT; } // server-specific message of the day s = CG_ConfigString( CS_MOTD ); if ( s[0] ) { UI_DrawProportionalString( 320, y, s, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT; } // some extra space after hostname and motd y += 10; } // map-specific message (long map name) s = CG_ConfigString( CS_MESSAGE ); if ( s[0] ) { UI_DrawProportionalString( 320, y, s, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT; } // cheats warning s = Info_ValueForKey( sysInfo, "sv_cheats" ); if ( s[0] == '1' ) { UI_DrawProportionalString( 320, y, "CHEATS ARE ENABLED", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT; } // game type UI_DrawProportionalString( 320, y, cgs.gametypeName, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT; //.........这里部分代码省略.........
开发者ID:KuehnhammerTobias,项目名称:ioid3-game,代码行数:101,
注:本文中的trap_R_DrawStretchPic函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ trap_R_RegisterModel函数代码示例 C++ trap_R_AddRefEntityToScene函数代码示例 |