From db28736d8181f1d954748509fd0c8e4952c61b9e Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Tue, 13 Aug 2024 23:24:19 +0800 Subject: [PATCH] [saco] Implement/match `CFontRender::RenderText(...)` --- saco/fontrender.cpp | 31 +++++++++++++++++++++++++++++++ saco/fontrender.h | 1 + 2 files changed, 32 insertions(+) diff --git a/saco/fontrender.cpp b/saco/fontrender.cpp index b60525c..fb900a4 100644 --- a/saco/fontrender.cpp +++ b/saco/fontrender.cpp @@ -206,3 +206,34 @@ void CFontRender::RenderText(ID3DXSprite *pSprite, char * sz, RECT rect, DWORD d pSprite->End(); } +void CFontRender::RenderText(char *sz, RECT rect, DWORD dwColor) +{ + if(sz == NULL || sz[0] == '\0') return; + + ID3DXSprite *pSprite = field_14; + + pSprite->Begin( D3DXSPRITE_ALPHABLEND ); + + if(strlen(sz) > 100000) return; + + strcpy(field_1C, sz); + RemoveColorEmbedsFromString(field_1C); + DWORD dwStrLen = (DWORD)strlen(field_1C); + + rect.top -= 2; + field_10->DrawText(pSprite,field_1C,dwStrLen,&rect,DT_NOCLIP|DT_CENTER|DT_VCENTER,D3DCOLOR_ARGB(180, 240, 238, 228)); + rect.top += 2; + rect.left += 2; + field_10->DrawText(pSprite,field_1C,dwStrLen,&rect,DT_NOCLIP|DT_CENTER|DT_VCENTER,D3DCOLOR_ARGB(180, 240, 238, 228)); + rect.left -= 2; + rect.top += 2; + field_10->DrawText(pSprite,field_1C,dwStrLen,&rect,DT_NOCLIP|DT_CENTER|DT_VCENTER,D3DCOLOR_ARGB(180, 240, 238, 228)); + rect.top -= 2; + rect.left -= 2; + field_10->DrawText(pSprite,field_1C,dwStrLen,&rect,DT_NOCLIP|DT_CENTER|DT_VCENTER,D3DCOLOR_ARGB(180, 240, 238, 228)); + rect.left += 2; + + field_10->DrawText(pSprite,sz,-1,&rect,DT_NOCLIP|DT_CENTER|DT_VCENTER,dwColor); + + pSprite->End(); +} diff --git a/saco/fontrender.h b/saco/fontrender.h index 56dec97..f84196f 100644 --- a/saco/fontrender.h +++ b/saco/fontrender.h @@ -29,4 +29,5 @@ public: 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); + void RenderText(char *sz, RECT rect, DWORD dwColor); };