Code:
class cFont
{
public:
LPD3DXFONT g_pFont;
void FontManager (LPDIRECT3DDEVICE9 pDevice)
{
if (g_pFont)
{
g_pFont->Release();
g_pFont = NULL;
}
D3DXCreateFont( pDevice,
14,
0,
FW_BOLD,
1,
0,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE,
"Arial",
&g_pFont );
}
}Font;
DllMain.cpp
Code:
void cooperativeStatus(LPDIRECT3DDEVICE9 pDevice)
{
HRESULT cooperativeStat = pDevice->TestCooperativeLevel();
switch (cooperativeStat)
{
case D3DERR_DEVICELOST:
Sleep(1000);
Font.g_pFont->OnLostDevice();
break;
case D3DERR_DEVICENOTRESET:
Font.g_pFont->OnResetDevice();
break;
case D3DERR_DRIVERINTERNALERROR:
break;
case D3D_OK: //Do youre drawings here
if (MenuShow)
{
RenderMenu(pDevice);
}
break;
}
}
Now just call them in you're present hook and youre good to go lol
Code:
HRESULT APIENTRY MyPresent ( LPDIRECT3DDEVICE9 pDevice,
const RECT *pSourceRect,
const RECT *pDestRect,
HWND hDestWindowOverride,
const RGNDATA *pDirtyRegion )
{
_asm pushad;
Font.FontManager(pDevice);
cooperativeStatus(pDevice);
_asm popad;
return RealPresent(pDevice,pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion);
}
Hope this helps some of you