Ejemplo n.º 1
0
bool PackedEntity::CompareRecipients( const CUtlMemory<CSendProxyRecipients> &recipients )
{
	if ( recipients.Count() != m_Recipients.Count() )
		return false;
	
	return memcmp( recipients.Base(), m_Recipients.Base(), sizeof( CSendProxyRecipients ) * m_Recipients.Count() ) == 0;
}	
void CTGAImagePanel::Paint()
{
	if ( !m_bLoadedTexture )
	{
		m_bLoadedTexture = true;
		// get a texture id, if we haven't already
		if ( m_iTextureID < 0 )
		{
			m_iTextureID = vgui::surface()->CreateNewTextureID( true );
			SetSize( 180, 100 );
		}

		// load the file
		CUtlMemory<unsigned char> tga;
#ifndef _XBOX
		if ( TGALoader::LoadRGBA8888( m_szTGAName, tga, m_iImageWidth, m_iImageHeight ) )
		{
			// set the textureID
			surface()->DrawSetTextureRGBA( m_iTextureID, tga.Base(), m_iImageWidth, m_iImageHeight, false, true );
			m_bHasValidTexture = true;
			// set our size to be the size of the tga
			SetSize( m_iImageWidth, m_iImageHeight );
		}
		else
#endif
		{
			m_bHasValidTexture = false;
		}
	}

	// draw the image
	int wide, tall;
	if ( m_bHasValidTexture )
	{
		surface()->DrawGetTextureSize( m_iTextureID, wide, tall );
		surface()->DrawSetTexture( m_iTextureID );
		surface()->DrawSetColor( 255, 255, 255, 255 );
		surface()->DrawTexturedRect( 0, 0, wide, tall );
	}
	else
	{
		// draw a black fill instead
		wide = 180, tall = 100;
		surface()->DrawSetColor( 0, 0, 0, 255 );
		surface()->DrawFilledRect( 0, 0, wide, tall );
	}
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
// Generate the low-res image bits
//-----------------------------------------------------------------------------
bool CVTFTexture::ConstructLowResImage()
{
	Assert( m_Format == IMAGE_FORMAT_RGBA8888 );
	Assert( m_pLowResImageData );

	CUtlMemory<unsigned char> lowResSizeImage;
	lowResSizeImage.EnsureCapacity( m_nLowResImageWidth * m_nLowResImageHeight * 4 );
	unsigned char *tmpImage = lowResSizeImage.Base();
	if( !ImageLoader::ResampleRGBA8888( ImageData(0, 0, 0), tmpImage, 
		m_nWidth, m_nHeight, m_nLowResImageWidth, m_nLowResImageHeight, 2.2f, 2.2f ) )
	{
		return false;
	}
	
	// convert to the low-res size version with the correct image format
	return ImageLoader::ConvertImageFormat( tmpImage, IMAGE_FORMAT_RGBA8888, 
		m_pLowResImageData, m_LowResImageFormat, m_nLowResImageWidth, m_nLowResImageHeight ); 
}
Ejemplo n.º 4
0
void PackedEntity::SetRecipients( const CUtlMemory<CSendProxyRecipients> &recipients )
{
	m_Recipients.CopyArray( recipients.Base(), recipients.Count() );
}
Ejemplo n.º 5
0
inline void CUtlBinaryBlock::Purge()
{
    SetLength(0);
    m_Memory.Purge();
}
Ejemplo n.º 6
0
inline bool CUtlBinaryBlock::IsReadOnly() const
{
    return m_Memory.IsReadOnly();
}
Ejemplo n.º 7
0
inline void *CUtlBinaryBlock::Get()
{
    return m_Memory.Base();
}
Ejemplo n.º 8
0
//-----------------------------------------------------------------------------
// class inlines
//-----------------------------------------------------------------------------
inline const void *CUtlBinaryBlock::Get() const
{
    return m_Memory.Base();
}