You need to define menux, menuy, width, and height! In you globals
Add to you globals
[PHP]POINT dragPos, dragOffset;
bool dragging=false;[/PHP]
//DEFINE
[PHP]bool isMouseinRegion(int x1, int y1, int x2, int y2)
{
POINT cPos;
GetCursorPos(&cPos);
if(cPos.x > x1 && cPos.x < x2 && cPos.y > y1 && cPos.y < y2){
return true;
} else {
return false;
}
}[/PHP]
Put this were you put your hacks or were your menu is being built!
[PHP]if((dragging && GetAsyncKeyState(VK_LBUTTON)<0) || (GetAsyncKeyState(VK_LBUTTON)&1)){
GetCursorPos(&dragPos);
//ScreenToClient(GetForegroundWindow(),&dragPos);
//You can choose to include this or not.
if (!dragging){
if (isMouseinRegion(menux,menuy,menux+width,menuy+wha tever)){
if (!Menu.MenuClick(menux, menuy, width, dragPos)) {
//^^ if inside the bounds of the window
//then setup the winodow so that it will drag
dragOffset.x = dragPos.x-menux;
dragOffset.y = dragPos.y-menuy;
dragging = true;
Directx.DrawString( 10, 50, D3DCOLOR_ARGB(255, 255, 0,0), Directx.pFont, "start drag");
}
}
}else{//if we are dragging a window then
menux = dragPos.x - dragOffset.x;
menuy = dragPos.y - dragOffset.y;
Directx.DrawString( 10, 50, D3DCOLOR_ARGB(255, 255, 0,0), Directx.pFont, "Dragging...");
}
}else{
dragging = false;
Directx.DrawString( 10, 50, D3DCOLOR_ARGB(255, 255, 0,0), Directx.pFont, "Drag stopped");
}
[/PHP]