I actually used this code in my menu base a while back and for those of you who are tired of using the arrow keys to move your menu, here's a fresh change of pace.
I wrote this code for the release whit made of Gellin's and Hans' bases. It can be adapted to other bases but you should do that yourself.
We start with some global variables, declared in the global scope.
We got 2 POINT structures, pos for taking in the mouse cordinates, and dragOffset for holding.Code:POINT pos, dragOffset; bool dragging=false; int width, height;
Then we have a bool dragging that just is used to tell weather or not we're dragging the menu.
Finally, we have the width and height variables. These AREN'T DEFINED and should be setup and changed according to your hack's needs.
Then we use this handy function, courtesy of crash or whoever he got it from. This is just used to determine if the mouse is within a rectangle formed by a pair of points.
Finally we got the meat of the code which should be put in your main thread or in your hooked function or w/e. I put in a bunch of comments and most of this should be understandable.Code: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; } }
Anyways there you have it, now you can make your menu's a little better.Code:if(GetAsyncKeyState(VK_LBUTTON)<0){ GetCursorPos(&pos); //ScreenToClient(GetForegroundWindow(),&pos); //You can choose to include this or not. if (!dragging){//if not currently dragging a window then see if our click is if (isMouseinRegion(menux,menuy,menux+width,menuy+height)){ //^^ if inside the bounds of the window //then setup the winodw so that it will drag dragOffset.x = pos.x-menux; dragOffset.y = pos.y-menuy; dragging = true; } }else{//if we are dragging a window then menux = pos.x - dragOffset.x; menuy = pos.y - dragOffset.y; } }else{ dragging = false; }
This is not noob-proof and if you follow my directions it shouldn't be hard to implement.