[saco] Implement/match CFontRender::RenderText(...)

This commit is contained in:
RD42 2024-08-13 23:24:07 +08:00
parent b26a287a0b
commit aee889c32c
2 changed files with 38 additions and 0 deletions

View File

@ -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();
}

View File

@ -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);
};