Code:
void FillRGB( int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* pDevice )
{
if( w < 0 )w = 1;
if( h < 0 )h = 1;
if( x < 0 )x = 1;
if( y < 0 )y = 1;
D3DRECT rec = { x, y, x + w, y + h };
pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );
}
void DrawBorder( int x, int y, int w, int h, int px, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
{
FillRGB( x, (y + h - px), w, px, BorderColor, pDevice );
FillRGB( x, y, px, h, BorderColor, pDevice );
FillRGB( x, y, w, px, BorderColor, pDevice );
FillRGB( (x + w - px), y, px, h, BorderColor, pDevice );
}
void DrawBox( int x, int y, int w, int h, D3DCOLOR BoxColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
{
FillRGB( x, y, w, h, BoxColor, pDevice );
DrawBorder( x, y, w, h, 1, BorderColor, pDevice );
}
cBase Base;
void cBase::RenderFrame(LPDIRECT3DDEVICE9 pDevice)
{
if(Directx.pFont == NULL)
D3DXCreateFont(pDevice, 15, 0, 350, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &Directx.pFont );
if(Directx.pFont2 == NULL)
D3DXCreateFont(pDevice, 18, 0, 700, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial Black", &Directx.pFont2 );
if(sprite){
D3DXCreateTextureFromFileInMemory(pDevice,&Menupic,sizeof(Menupic),&MenuTexture);
D3DXCreateSprite(pDevice,&Sprite);
sprite = FALSE;
}
D3DXVECTOR3 POS;
POS.x = 15;
POS.y = 15;
POS.z = 0;
if (Mmax==0) Menu.RenderMenu();
if(Mvisible){
DrawBox (X,Y,W,H,Back Color,Border Color,pDevice);