mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-01-03 16:13:34 +08:00
[saco] Implement CDXUTDialogResourceManager::AddFont(...)
This commit is contained in:
parent
fd4965bf98
commit
efc90f78e3
@ -219,6 +219,42 @@ VOID CDXUTDialog::SendEvent( UINT nEvent, bool bTriggeredByUser, CDXUTControl* p
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
int CDXUTDialogResourceManager::AddFont( LPCTSTR strFaceName, LONG height, LONG weight )
|
||||
{
|
||||
// See if this font already exists
|
||||
for( int i=0; i < m_FontCache.GetSize(); i++ )
|
||||
{
|
||||
DXUTFontNode* pFontNode = m_FontCache.GetAt(i);
|
||||
if( 0 == _strnicmp( pFontNode->strFace, strFaceName, MAX_PATH-1 ) &&
|
||||
pFontNode->nHeight == height &&
|
||||
pFontNode->nWeight == weight )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// Add a new font and try to create it
|
||||
DXUTFontNode* pNewFontNode = new DXUTFontNode();
|
||||
if( pNewFontNode == NULL )
|
||||
return -1;
|
||||
|
||||
ZeroMemory( pNewFontNode, sizeof(DXUTFontNode) );
|
||||
StringCchCopy( pNewFontNode->strFace, MAX_PATH, strFaceName );
|
||||
pNewFontNode->nHeight = height;
|
||||
pNewFontNode->nWeight = weight;
|
||||
m_FontCache.Add( pNewFontNode );
|
||||
|
||||
int iFont = m_FontCache.GetSize()-1;
|
||||
|
||||
// If a device is available, try to create immediately
|
||||
if( m_pd3dDevice )
|
||||
CreateFont( iFont );
|
||||
|
||||
return iFont;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// CDXUTControl class
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
@ -181,6 +181,8 @@ public:
|
||||
HRESULT OnResetDevice();
|
||||
void OnLostDevice();
|
||||
void OnDestroyDevice();
|
||||
|
||||
int AddFont( LPCTSTR strFaceName, LONG height, LONG weight );
|
||||
|
||||
// Shared between all dialogs
|
||||
IDirect3DStateBlock9* m_pStateBlock;
|
||||
|
Loading…
x
Reference in New Issue
Block a user