From 1f100e5d90c6b5c75fd812d769b0066e843022cb Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sat, 18 May 2024 22:54:36 +0800 Subject: [PATCH] [saco] Implement `CDXUTElement::SetFont(...)` --- saco/d3d9/common/DXUTgui.cpp | 11 +++++++++++ saco/d3d9/common/DXUTgui.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/saco/d3d9/common/DXUTgui.cpp b/saco/d3d9/common/DXUTgui.cpp index 6612efb..6bbcb81 100644 --- a/saco/d3d9/common/DXUTgui.cpp +++ b/saco/d3d9/common/DXUTgui.cpp @@ -214,3 +214,14 @@ void CDXUTElement::SetTexture( UINT iTexture, RECT* prcTexture, D3DCOLOR default } +//-------------------------------------------------------------------------------------- +void CDXUTElement::SetFont( UINT iFont, D3DCOLOR defaultFontColor, DWORD dwTextFormat ) +{ + this->iFont = iFont; + this->dwTextFormat = dwTextFormat; + + FontColor.Init( defaultFontColor ); +} + + +//-------------------------------------------------------------------------------------- diff --git a/saco/d3d9/common/DXUTgui.h b/saco/d3d9/common/DXUTgui.h index dffea2c..949908a 100644 --- a/saco/d3d9/common/DXUTgui.h +++ b/saco/d3d9/common/DXUTgui.h @@ -66,6 +66,8 @@ class CDXUTElement { public: void SetTexture( UINT iTexture, RECT* prcTexture, D3DCOLOR defaultTextureColor = D3DCOLOR_ARGB(255, 255, 255, 255) ); + void SetFont( UINT iFont, D3DCOLOR defaultFontColor = D3DCOLOR_ARGB(255, 255, 255, 255), DWORD dwTextFormat = DT_CENTER | DT_VCENTER ); + UINT iTexture; // Index of the texture for this Element UINT iFont; // Index of the font for this Element DWORD dwTextFormat; // The format argument to DrawText