Hey guys, i think i've finish my first menu
Of course i've got help from the community specially Crypt
I know there are other ways to do that, but i had a few problems with some deprecated functions lol, had to implement a few things!
Vars
Code:
LPD3DXFONT d_font, m_font;
int iIndicator = 0;
BOOL iWH= false;
BOOL iCH = false;
Drawing my Menu options..
Code:
void DrawMenuOption(LPDIRECT3DDEVICE9 pDevice, int y, char * szText, BOOL Option, int Indication)
{
char on[3] = "ON";
char off[4] = "OFF";
char opt[100];
if (Option)
strcpy_s(opt, 100, on);
else
strcpy_s(opt, 100, off);
D3DXCreateFont(pDevice, 16, 0, FW_BOLD, 0, 0, 1, 0, 0, 0 | FF_DONTCARE, TEXT("Arial"), &m_font);
RECT rFont = { 20, y, 140, 100 };
if (Option)
{
m_font->DrawText(NULL, szText, -1, &rFont, DT_LEFT, GREEN);
m_font->DrawText(NULL, opt, -1, &rFont, DT_RIGHT, GREEN);
}
else
{
if (iIndicator == Indication)
{
m_font->DrawText(NULL, szText, -1, &rFont, DT_LEFT, YELLOW);
m_font->DrawText(NULL, opt, -1, &rFont, DT_RIGHT, YELLOW);
}
else
{
m_font->DrawTextA(NULL, szText, -1, &rFont, DT_LEFT, WHITE);
m_font->DrawTextA(NULL, opt, -1, &rFont, DT_RIGHT, WHITE);
}
}
}
Drawing my menu template
Code:
//DRAWING MY MENU
void g4xMenu(IDirect3DDevice9* dev, int x, int y, int w, int h)
{
D3DRECT bBord = { x - 2, y - 2, x + w + 2, y + h + 2 };
D3DRECT bRect = { x, y, x + w, y + h };
D3DRECT bTitle = { x + 7, y + 7, x + w - 7, y + h / 4 };
dev->Clear(1, &bBord, D3DCLEAR_TARGET | D3DCLEAR_TARGET, WHITE, 0, 0);
dev->Clear(1, &bRect, D3DCLEAR_TARGET | D3DCLEAR_TARGET, LIGHT_DARK_GRAY, 0, 0);
dev->Clear(1, &bTitle, D3DCLEAR_TARGET | D3DCLEAR_TARGET, DARK_GRAY, 0, 0);
DrawTextCenter(dev, "g4x - darkhook.net", 30, 23, WHITE);
//ADDING OPTIONS
DrawMenuOption(dev, 60, "Wallhack", iWH, 0);
DrawMenuOption(dev, 80, "Crosshair", iCH, 1);
}
EndScene
Code:
g4xMenu(pDevice, 10, 10, 170, 140);
Of course i've got help from the community specially Crypt
I know there are other ways to do that, but i had a few problems with some deprecated functions lol, had to implement a few things!
Vars
Code:
LPD3DXFONT d_font, m_font;
int iIndicator = 0;
BOOL iWH= false;
BOOL iCH = false;
Drawing my Menu options..
Code:
void DrawMenuOption(LPDIRECT3DDEVICE9 pDevice, int y, char * szText, BOOL Option, int Indication)
{
char on[3] = "ON";
char off[4] = "OFF";
char opt[100];
if (Option)
strcpy_s(opt, 100, on);
else
strcpy_s(opt, 100, off);
D3DXCreateFont(pDevice, 16, 0, FW_BOLD, 0, 0, 1, 0, 0, 0 | FF_DONTCARE, TEXT("Arial"), &m_font);
RECT rFont = { 20, y, 140, 100 };
if (Option)
{
m_font->DrawText(NULL, szText, -1, &rFont, DT_LEFT, GREEN);
m_font->DrawText(NULL, opt, -1, &rFont, DT_RIGHT, GREEN);
}
else
{
if (iIndicator == Indication)
{
m_font->DrawText(NULL, szText, -1, &rFont, DT_LEFT, YELLOW);
m_font->DrawText(NULL, opt, -1, &rFont, DT_RIGHT, YELLOW);
}
else
{
m_font->DrawTextA(NULL, szText, -1, &rFont, DT_LEFT, WHITE);
m_font->DrawTextA(NULL, opt, -1, &rFont, DT_RIGHT, WHITE);
}
}
}
Drawing my menu template
Code:
//DRAWING MY MENU
void g4xMenu(IDirect3DDevice9* dev, int x, int y, int w, int h)
{
D3DRECT bBord = { x - 2, y - 2, x + w + 2, y + h + 2 };
D3DRECT bRect = { x, y, x + w, y + h };
D3DRECT bTitle = { x + 7, y + 7, x + w - 7, y + h / 4 };
dev->Clear(1, &bBord, D3DCLEAR_TARGET | D3DCLEAR_TARGET, WHITE, 0, 0);
dev->Clear(1, &bRect, D3DCLEAR_TARGET | D3DCLEAR_TARGET, LIGHT_DARK_GRAY, 0, 0);
dev->Clear(1, &bTitle, D3DCLEAR_TARGET | D3DCLEAR_TARGET, DARK_GRAY, 0, 0);
DrawTextCenter(dev, "g4x - darkhook.net", 30, 23, WHITE);
//ADDING OPTIONS
DrawMenuOption(dev, 60, "Wallhack", iWH, 0);
DrawMenuOption(dev, 80, "Crosshair", iCH, 1);
}
EndScene
Code:
g4xMenu(pDevice, 10, 10, 170, 140);