/*
=================
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 );
	}
}
Exemple #2
0
/*
=================
UI_DrawPic
=================
*/
void UI_DrawPic( 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_Draw( x, y, width, height );
}
Exemple #3
0
/*
=================
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;
	}
}