void UI_DrawTitleAnim() { UI_SetupTitleQuad(); if( !TransPic ) return; wrect_t r = { 0, uiStatic.buttons_width, 26, 51 }; float frac = UI_GetTitleTransFraction();/*(sin(gpGlobals->time*4)+1)/2*/; #ifdef TA_ALT_MODE if( frac == 1 && transition_state == AS_TO_BUTTON ) return; #else if( frac == 1 ) return; #endif ui_quad_t c; int f_idx = (transition_state == AS_TO_TITLE) ? 0 : 1; int s_idx = (transition_state == AS_TO_TITLE) ? 1 : 0; LerpQuad( TitleLerpQuads[f_idx], TitleLerpQuads[s_idx], frac, &c ); PIC_Set( TransPic, 255, 255, 255, 255 ); PIC_DrawAdditive( c.x, c.y, c.lx, c.ly, &r ); }
/* ================= UI_PlayerSetup_Ownerdraw ================= */ static void UI_PlayerSetup_Ownerdraw( void *self ) { menuCommon_s *item = (menuCommon_s *)self; // draw the background UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor ); // draw the rectangle UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor ); if( !ui_showmodels->value && playerImage != 0 ) { PIC_Set( playerImage, 255, 255, 255, 255 ); PIC_Draw( item->x, item->y, item->width, item->height ); } else { R_ClearScene (); // update renderer timings uiPlayerSetup.refdef.time = gpGlobals->time; uiPlayerSetup.refdef.frametime = gpGlobals->frametime; uiPlayerSetup.ent->curstate.body = 0; // clearing body each frame // draw the player model R_AddEntity( ET_NORMAL, uiPlayerSetup.ent ); R_RenderFrame( &uiPlayerSetup.refdef ); } }
static void UI_Preview_Ownerdraw( void *self ) { menuCommon_s *item = (menuCommon_s *)self; UI_FillRect( item->x - 2, item->y - 2, item->width + 4, item->height + 4, 0xFFC0C0C0 ); UI_FillRect( item->x, item->y, item->width, item->height, 0xFF808080 ); PIC_Set( uiFileDialog.image, 255, 255, 255, 255 ); PIC_DrawTrans( item->x, item->y, item->width, item->height ); }
/* ================= UI_DrawPicAdditive ================= */ void UI_DrawPicAdditive( int x, int y, int width, int height, const int color, const char *pic ) { HIMAGE hPic = PIC_Load( pic ); int r, g, b, a; UnpackRGBA( r, g, b, a, color ); PIC_Set( hPic, r, g, b, a ); PIC_DrawAdditive( x, y, width, height ); }
static void UI_Preview_Ownerdraw( void *self ) { menuCommon_s *item = (menuCommon_s *)self; UI_FillRect( item->x - 2, item->y - 2, item->width + 4, item->height + 4, 0xFFC0C0C0 ); UI_FillRect( item->x, item->y, item->width, item->height, 0xFF808080 ); PIC_Set( uiTouchButtons.textureid, CURCOLOR1(red), CURCOLOR1(green), CURCOLOR1(blue), CURCOLOR1(alpha)); if( uiTouchButtons.additive.enabled ) PIC_DrawAdditive( item->x, item->y, item->width, item->height ); else PIC_DrawTrans( item->x, item->y, item->width, item->height ); }
/* ================= UI_DrawBackground_Callback ================= */ void UI_DrawBackground_Callback( void *self ) { if (!uiStatic.m_fHaveSteamBackground) { menuCommon_s *item = (menuCommon_s *)self; UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic ); return; } int xpos, ypos; float xScale, yScale; // work out scaling factors xScale = ScreenWidth / uiStatic.m_flTotalWidth; yScale = ScreenHeight / uiStatic.m_flTotalHeight; // iterate and draw all the background pieces ypos = 0; for (int y = 0; y < BACKGROUND_ROWS; y++) { xpos = 0; for (int x = 0; x < BACKGROUND_COLUMNS; x++) { bimage_t &bimage = uiStatic.m_SteamBackground[y][x]; int dx = (int)ceil(xpos * xScale); int dy = (int)ceil(ypos * yScale); int dw = (int)ceil(bimage.width * xScale); int dt = (int)ceil(bimage.height * yScale); if (x == 0) dx = 0; if (y == 0) dy = 0; PIC_Set( bimage.hImage, 255, 255, 255, 255 ); PIC_Draw( dx, dy, dw, dt ); xpos += bimage.width; } ypos += uiStatic.m_SteamBackground[y][0].height; } }
/* ================= UI_Crosshair_Ownerdraw ================= */ static void UI_Crosshair_Ownerdraw( void *self ) { menuBitmap_s *item = (menuBitmap_s*)self; UI_DrawPic(item->generic.x, item->generic.y, item->generic.width, item->generic.height, 0x00FFFFFF, "gfx/vgui/crosshair" ); int l; switch( (int)uiPlayerSetup.crosshairSize.curValue ) { case 1: l = 10; break; case 2: l = 20; break; case 3: l = 30; break; case 0: if( ScreenWidth < 640 ) l = 30; else if( ScreenWidth < 1024 ) l = 20; else l = 10; } l *= ScreenHeight / 768.0f; int x = item->generic.x, // xpos y = item->generic.y, // ypos w = item->generic.width, // width h = item->generic.height, // height // delta distance d = (item->generic.width / 2 - l) * 0.5, // alpha a = 180, // red r = g_iCrosshairAvailColors[(int)uiPlayerSetup.crosshairColor.curValue][0], // green g = g_iCrosshairAvailColors[(int)uiPlayerSetup.crosshairColor.curValue][1], // blue b = g_iCrosshairAvailColors[(int)uiPlayerSetup.crosshairColor.curValue][2]; if( uiPlayerSetup.crosshairTranslucent.enabled ) { // verical PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a); PIC_DrawTrans(x + w / 2, y + d, 1, l ); PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a); PIC_DrawTrans(x + w / 2, y + h / 2 + d, 1, l ); // horizontal PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a); PIC_DrawTrans(x + d, y + h / 2, l, 1 ); PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a); PIC_DrawTrans(x + w / 2 + d, y + h / 2, l, 1 ); } else { // verical PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a); PIC_DrawAdditive(x + w / 2, y + d, 1, l ); PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a); PIC_DrawAdditive(x + w / 2, y + h / 2 + d, 1, l ); // horizontal PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a); PIC_DrawAdditive(x + d, y + h / 2, l, 1 ); PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a); PIC_DrawAdditive(x + w / 2 + d, y + h / 2, l, 1 ); } #if 0 // verical FillRGBA(x + w / 2, y + d, 1, l, r, g, b, a); FillRGBA(x + w / 2, y + h / 2 + d, 1, l, r, g, b, a); // horizontal FillRGBA(x + d, y + h / 2, l, 1, r, g, b, a); FillRGBA(x + w / 2 + d, y + h / 2, l, 1, r, g, b, a); #endif }