From aee889c32c6f6bc1814298ca9e25863b90a52ada Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Tue, 13 Aug 2024 23:24:07 +0800 Subject: [PATCH] [saco] Implement/match `CFontRender::RenderText(...)` --- saco/fontrender.cpp | 37 +++++++++++++++++++++++++++++++++++++ saco/fontrender.h | 1 + 2 files changed, 38 insertions(+) diff --git a/saco/fontrender.cpp b/saco/fontrender.cpp index 1fb3626..b60525c 100644 --- a/saco/fontrender.cpp +++ b/saco/fontrender.cpp @@ -169,3 +169,40 @@ void CFontRender::RenderText(ID3DXSprite *pSprite, char * sz, RECT rect, DWORD d if(bLocalSprite) pSprite->End(); } + +void CFontRender::RenderText(ID3DXSprite *pSprite, char * sz, RECT rect, DWORD dwFormat, DWORD dwColor, BOOL bShadowed) +{ + if(sz == NULL || sz[0] == '\0') return; + + BOOL bLocalSprite = FALSE; + + if(!pSprite) { + pSprite = field_14; + bLocalSprite = TRUE; + pSprite->Begin( D3DXSPRITE_ALPHABLEND ); + } + + if(bShadowed) { + if(strlen(sz) > 100000) return; + + strcpy(field_1C, sz); + RemoveColorEmbedsFromString(field_1C); + DWORD dwStrLen = (DWORD)strlen(field_1C); + + rect.top -= 1; + field_C->DrawText(pSprite,field_1C,dwStrLen,&rect,dwFormat,0xFF000000); + rect.top += 2; + field_C->DrawText(pSprite,field_1C,dwStrLen,&rect,dwFormat,0xFF000000); + rect.top -= 1; + rect.left -= 1; + field_C->DrawText(pSprite,field_1C,dwStrLen,&rect,dwFormat,0xFF000000); + rect.left += 2; + field_C->DrawText(pSprite,field_1C,dwStrLen,&rect,dwFormat,0xFF000000); + rect.left -= 1; + } + field_4->DrawText(pSprite,sz,-1,&rect,dwFormat,dwColor); + + if(bLocalSprite) + pSprite->End(); +} + diff --git a/saco/fontrender.h b/saco/fontrender.h index c62315e..56dec97 100644 --- a/saco/fontrender.h +++ b/saco/fontrender.h @@ -28,4 +28,5 @@ public: SIZE MeasureText2(char * szString, DWORD dwFormat = DT_LEFT); void RenderText(ID3DXSprite *pSprite, char * sz, RECT rect, DWORD dwColor, BOOL bShadowed=TRUE); + void RenderText(ID3DXSprite *pSprite, char * sz, RECT rect, DWORD dwFormat, DWORD dwColor, BOOL bShadowed=TRUE); };