Ok guys.
I made a func to draw a button and it have hover effe*** and click effects.
But hwen i try to change a hack variable from 0 to 1(hack =! hack)
than it dont work.
My code:
Code:
void DrawButton(int x, int y, int h, D3DCOLOR BorderColor, D3DCOLOR FillColor, char* Caption, int hack, LPDIRECT3DDEVICE9 pDevice)
{
gets (Caption);
if(isMouseinRegion(menux+x,menuy+y,menux+x+strlen(Caption)*6,menuy+y+h) && !GetAsyncKeyState(VK_LBUTTON))
{
DrawBox(menux+x, menuy+y, strlen(Caption)*6, h, TransGrey, BorderColor, pDevice);
DrawString(menux+x+3, menuy+y+h/6, White, Directx_Font, Caption);
}
else if(isMouseinRegion(menux+x,menuy+y,menux+x+strlen(Caption)*6,menuy+y+h) && GetAsyncKeyState(VK_LBUTTON))
{
DrawBox(menux+x, menuy+y, strlen(Caption)*6, h, Yellow_a, BorderColor, pDevice);
DrawString(menux+x+6, menuy+y+h/4, White, Directx_Font, Caption);
hack = !hack;
}
else if(!isMouseinRegion(menux+x,menuy+y,menux+x+strlen(Caption)*6,menuy+y+h))
{
DrawBox(menux+x, menuy+y, strlen(Caption)*6, h, FillColor, BorderColor, pDevice);
DrawString(menux+x+3, menuy+y+h/6, White, Directx_Font, Caption);
}
}
and my call:
Code:
DrawButton(10, 10, 20, White, TransBlack, "lol", lol, pDevice);
Why my vaiable dont change?!