[saco] Implement CDXUTDialog::SetFont(...)

This commit is contained in:
RD42 2024-05-24 22:54:27 +08:00
parent efc90f78e3
commit d2c7139b01
2 changed files with 27 additions and 0 deletions

View File

@ -255,6 +255,29 @@ int CDXUTDialogResourceManager::AddFont( LPCTSTR strFaceName, LONG height, LONG
} }
//--------------------------------------------------------------------------------------
HRESULT CDXUTDialog::SetFont( UINT index, LPCTSTR strFaceName, LONG height, LONG weight )
{
// If this assert triggers, you need to call CDXUTDialog::Init() first. This change
// was made so that the DXUT's GUI could become seperate and optional from DXUT's core. The
// creation and interfacing with CDXUTDialogResourceManager is now the responsibility
// of the application if it wishes to use DXUT's GUI.
assert( m_pManager != NULL && "To fix call CDXUTDialog::Init() first. See comments for details." );
// Make sure the list is at least as large as the index being set
UINT i;
for( i=m_Fonts.GetSize(); i <= index; i++ )
{
m_Fonts.Add( -1 );
}
int iFont = m_pManager->AddFont( strFaceName, height, weight );
m_Fonts.SetAt( index, iFont );
return S_OK;
}
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// CDXUTControl class // CDXUTControl class
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@ -103,6 +103,10 @@ public:
// Device state notification // Device state notification
void Refresh(); void Refresh();
// Shared resource access. Indexed fonts and textures are shared among
// all the controls.
HRESULT SetFont( UINT index, LPCTSTR strFaceName, LONG height, LONG weight );
bool m_bNonUserEvents; bool m_bNonUserEvents;
bool m_bKeyboardInput; bool m_bKeyboardInput;