//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CAvatarImage::SetAvatarSteamID( CSteamID steamIDUser )
{
	ClearAvatarSteamID();

	if ( steamapicontext->SteamFriends() && steamapicontext->SteamUtils() )
	{
		m_SteamID = steamIDUser;

		int iAvatar = steamapicontext->SteamFriends()->GetFriendAvatar( steamIDUser );

		/*
		// See if it's in our list already
		*/

		uint32 wide, tall;
		if ( steamapicontext->SteamUtils()->GetImageSize( iAvatar, &wide, &tall ) )
		{
			int cubImage = wide * tall * 4;
			byte *rgubDest = (byte*)_alloca( cubImage );
			steamapicontext->SteamUtils()->GetImageRGBA( iAvatar, rgubDest, cubImage );
			InitFromRGBA( rgubDest, wide, tall );

			/*
			// put it in the list
			RGBAImage *pRGBAImage = new RGBAImage( rgubDest, wide, tall );
			int iImageList = m_pImageList->AddImage( pRGBAImage );
			m_mapAvatarToIImageList.Insert( iAvatar, iImageList );
			*/
		}

		UpdateFriendStatus();
	}

	return m_bValid;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
CAvatarImage::CAvatarImage( void )
{
	ClearAvatarSteamID();
	m_pFriendIcon = NULL;
	m_nX = 0;
	m_nY = 0;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CAvatarImage::SetAvatarSteamID( CSteamID steamIDUser )
{
	ClearAvatarSteamID();
#ifndef NO_STEAM
	if ( SteamFriends() && SteamUtils() )
	{
		int iAvatar = SteamFriends()->GetFriendAvatar( steamIDUser );

		/*
		// See if it's in our list already
		*/

		uint32 wide, tall;
		if ( SteamUtils()->GetImageSize( iAvatar, &wide, &tall ) )
		{
			int cubImage = wide * tall * 4;
			byte *rgubDest = (byte*)_alloca( cubImage );
			SteamUtils()->GetImageRGBA( iAvatar, rgubDest, cubImage );
			InitFromRGBA( rgubDest, wide, tall );

			/*
			// put it in the list
			RGBAImage *pRGBAImage = new RGBAImage( rgubDest, wide, tall );
			int iImageList = m_pImageList->AddImage( pRGBAImage );
			m_mapAvatarToIImageList.Insert( iAvatar, iImageList );
			*/
		}
	}
#endif
	return m_bValid;
}
Example #4
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
CAvatarImage::CAvatarImage( void )
{
	m_iTextureID = -1;
	ClearAvatarSteamID();
	m_SourceArtSize = k_EAvatarSize32x32;
	m_pFriendIcon = NULL;
	m_nX = 0;
	m_nY = 0;
}
Example #5
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CGameUiAvatarImage::SetAvatarSteamID( CSteamID steamIDUser )
{
	ClearAvatarSteamID();

	if ( steamapicontext->SteamFriends() && steamapicontext->SteamUtils() )
	{
		int iAvatar = steamapicontext->SteamFriends()->GetMediumFriendAvatar( steamIDUser );

		/*
		// See if it's in our list already
		*/

		uint32 wide, tall;
		if ( steamapicontext->SteamUtils()->GetImageSize( iAvatar, &wide, &tall ) )
		{
			bool bUseSteamImage = true;
			if ( wide == 0 || tall == 0 )
			{
				// attempt to handle rare data integrity issue, avatar got lost
				bUseSteamImage = false;
				// mock up solid white as 64x64
				wide = tall = 64;
			}			

			int cubImage = wide * tall * 4;
			byte *rgubDest = (byte*)_alloca( cubImage );
			if ( bUseSteamImage )
			{
				steamapicontext->SteamUtils()->GetImageRGBA( iAvatar, rgubDest, cubImage );
			}
			else
			{
				// solid white, avoids any issue with where the alpha channel is
				memset( rgubDest, 0xFF, cubImage );
			}
			InitFromRGBA( rgubDest, wide, tall );

			m_flFetchedTime = Plat_FloatTime();
		}
	}

	return m_bValid;
}
Example #6
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
CAvatarImage::CAvatarImage( void )
{
	ClearAvatarSteamID();
}