mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[saco] Implement/match CFontRender::MeasureText(...)
This commit is contained in:
parent
07904813b5
commit
05250c0aa2
@ -1,6 +1,6 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "fontrender.h"
|
||||
#include "game/util.h"
|
||||
|
||||
int GetFontSize();
|
||||
int GetFontWeight();
|
||||
@ -105,11 +105,18 @@ void CFontRender::RestoreDeviceObjects()
|
||||
|
||||
SIZE CFontRender::MeasureText(char * szString, DWORD dwFormat)
|
||||
{
|
||||
SIZE size = {0,0};
|
||||
RECT rect;
|
||||
SIZE ret = {0, 0};
|
||||
|
||||
// TODO: CFontRender::MeasureText .text:1006B200
|
||||
|
||||
return size;
|
||||
if(strlen(szString) > 100000) return ret;
|
||||
|
||||
strcpy(field_1C,szString);
|
||||
RemoveColorEmbedsFromString(field_1C);
|
||||
field_0->DrawTextA(NULL,field_1C,-1,&rect,dwFormat|DT_CALCRECT,0xFF000000);
|
||||
ret.cx = rect.right - rect.left;
|
||||
ret.cy = rect.bottom - rect.top;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CFontRender::RenderText(ID3DXSprite * pSprite, char * sz, RECT rect, DWORD dwColor, BOOL bShadowed)
|
||||
|
@ -1,22 +1,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
class CFontRender // size: 40
|
||||
class CFontRender
|
||||
{
|
||||
private:
|
||||
public:
|
||||
//char _gap0[40];
|
||||
ID3DXFontHook *field_0;
|
||||
ID3DXFontHook *field_4;
|
||||
ID3DXFont *field_8;
|
||||
ID3DXFont *field_C;
|
||||
ID3DXFont *field_10;
|
||||
ID3DXSprite* field_14;
|
||||
ID3DXSprite *field_14;
|
||||
IDirect3DDevice9 *m_pD3DDevice;
|
||||
CHAR *field_1C;
|
||||
char *field_1C;
|
||||
LONG field_20;
|
||||
LONG field_24;
|
||||
|
||||
public:
|
||||
|
||||
CFontRender(IDirect3DDevice9* pD3DDevice);
|
||||
~CFontRender();
|
||||
|
||||
@ -25,7 +24,7 @@ public:
|
||||
void DeleteDeviceObjects();
|
||||
void RestoreDeviceObjects();
|
||||
|
||||
SIZE MeasureText(char * szString, DWORD dwFormat = 0);
|
||||
SIZE MeasureText(char * szString, DWORD dwFormat = DT_LEFT);
|
||||
|
||||
void RenderText(ID3DXSprite * pSprite, char * sz, RECT rect, DWORD dwColor, BOOL bShadowed = TRUE);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user