Code:
HRESULT (APIENTRY *pfnEndScene)( IDirect3DDevice9 *pDevice );
HRESULT APIENTRY hook_EndScene( IDirect3DDevice9 *pDevice )
{
D3DRECT rec = { 0, 0, 20, 20 };
//pDevice->Clear(1, &rec, D3DCLEAR_TARGET, 0, 0, 0);
//pDevice->DrawText = geht leider nicht....
return pfnEndScene(pDevice);
}
Wie könnte man das am besten lösen, weil ja DrawText nicht im IDirect3DDevice9 drinne is?
Code:
INT DrawText(
LPD3DXSPRITE pSprite,
LPCTSTR pString,
int Count,
LPRECT pRect,
DWORD Format,
D3DCOLOR Color
);
HRESULT WINAPI D3DXCreateFont(
LPDIRECT3DDEVICE9 pDevice,
unsigned int Height,
unsigned int Width,
unsigned int Weight,
unsigned int MipLevels,
BOOL Italic,
DWORD CharSet,
DWORD OutputPrecision,
DWORD Quality,
DWORD PitchAndFamily,
LPCTSTR pFacename,
LPD3DXFONT *ppFont
);
HRESULT hr;
HRESULT (APIENTRY *pfnEndScene)( IDirect3DDevice9 *pDevice );
HRESULT APIENTRY hook_EndScene( IDirect3DDevice9 *pDevice ){
ID3DXFont *g_font=NULL;
const char *fps_string;
RECT font_rect;
fps_string= "test";
SetRect(&font_rect,0,0,20,20);
D3DRECT rec = { 0, 0, 20, 20 };
//pDevice->Clear(1, &rec, D3DCLEAR_TARGET, 0, 0, 0);
hr=D3DXCreateFont(pDevice, //D3D Device
22, //Font height
0, //Font width
FW_NORMAL, //Font Weight
1, //MipLevels
false, //Italic
DEFAULT_CHARSET, //CharSet
OUT_DEFAULT_PRECIS, //OutputPrecision
ANTIALIASED_QUALITY, //Quality
DEFAULT_PITCH|FF_DONTCARE,//PitchAndFamily
"Arial", //pFacename,
&g_font); //ppFont
g_font->DrawText(NULL, //pSprite
fps_string, //pString
-1, //Count
&font_rect, //pRect
DT_LEFT|DT_NOCLIP,//Format,
0xFFFFFFFF);
pDevice->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255,255, 0, 255), 0, 0);
return pfnEndScene(pDevice);
}