mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-09-20 12:46:07 +08:00
[saco] Implement/match CFontRender::MeasureText(...)
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "fontrender.h"
|
#include "game/util.h"
|
||||||
|
|
||||||
int GetFontSize();
|
int GetFontSize();
|
||||||
int GetFontWeight();
|
int GetFontWeight();
|
||||||
@ -105,11 +105,18 @@ void CFontRender::RestoreDeviceObjects()
|
|||||||
|
|
||||||
SIZE CFontRender::MeasureText(char * szString, DWORD dwFormat)
|
SIZE CFontRender::MeasureText(char * szString, DWORD dwFormat)
|
||||||
{
|
{
|
||||||
SIZE size = {0,0};
|
RECT rect;
|
||||||
|
SIZE ret = {0, 0};
|
||||||
|
|
||||||
// TODO: CFontRender::MeasureText .text:1006B200
|
if(strlen(szString) > 100000) return ret;
|
||||||
|
|
||||||
return size;
|
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)
|
void CFontRender::RenderText(ID3DXSprite * pSprite, char * sz, RECT rect, DWORD dwColor, BOOL bShadowed)
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CFontRender // size: 40
|
class CFontRender
|
||||||
{
|
{
|
||||||
private:
|
public:
|
||||||
|
//char _gap0[40];
|
||||||
ID3DXFontHook *field_0;
|
ID3DXFontHook *field_0;
|
||||||
ID3DXFontHook *field_4;
|
ID3DXFontHook *field_4;
|
||||||
ID3DXFont *field_8;
|
ID3DXFont *field_8;
|
||||||
ID3DXFont *field_C;
|
ID3DXFont *field_C;
|
||||||
ID3DXFont *field_10;
|
ID3DXFont *field_10;
|
||||||
ID3DXSprite* field_14;
|
ID3DXSprite *field_14;
|
||||||
IDirect3DDevice9 *m_pD3DDevice;
|
IDirect3DDevice9 *m_pD3DDevice;
|
||||||
CHAR *field_1C;
|
char *field_1C;
|
||||||
LONG field_20;
|
LONG field_20;
|
||||||
LONG field_24;
|
LONG field_24;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
CFontRender(IDirect3DDevice9* pD3DDevice);
|
CFontRender(IDirect3DDevice9* pD3DDevice);
|
||||||
~CFontRender();
|
~CFontRender();
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ public:
|
|||||||
void DeleteDeviceObjects();
|
void DeleteDeviceObjects();
|
||||||
void RestoreDeviceObjects();
|
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);
|
void RenderText(ID3DXSprite * pSprite, char * sz, RECT rect, DWORD dwColor, BOOL bShadowed = TRUE);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user