# Thread: Confused on Movable Box

1. ## Confused on Movable Box

Title is self explanatory.

I'm looking to make a dragging menu but confused on the math to make it so where ever the user clicks is where it drags from. Currently it moves the mouse to the corner of the menu being dragged.

2. add me
mcazeck@hotmail.com

3. Definitions:
Code:
```POINT cPos;
int menuX = 20, menuY = 100, offsetX, offsetY;```
Code:
```	if(GetAsyncKeyState(VK_LBUTTON) < 0)
{

GetCursorPos(&cPos);

if(cPos.x > menuX - 10 && cPos.x < menuX + 125 && cPos.y > menuY - 10 && cPos.y < menuY + 455){

if(!isDragging){

offsetX = cPos.x - menuX;
offsetY = cPos.y - menuY;
isDragging = true;
}
}
} else {

isDragging = false;
}
}
if(isDragging){

menuX = cPos.x - offsetX;
menuY = cPos.y - offsetY;
}```

4. ## The Following User Says Thank You to flameswor10 For This Useful Post:

-Dimensions- (07-21-2011)

5. Originally Posted by flameswor10
Definitions:
Code:
```POINT cPos;
int menuX = 20, menuY = 100, offsetX, offsetY;```
Code:
```	if(GetAsyncKeyState(VK_LBUTTON) < 0)
{

GetCursorPos(&cPos);

if(cPos.x > menuX - 10 && cPos.x < menuX + 125 && cPos.y > menuY - 10 && cPos.y < menuY + 455){

if(!isDragging){

offsetX = cPos.x - menuX;
offsetY = cPos.y - menuY;
isDragging = true;
}
}
} else {

isDragging = false;
}
}
if(isDragging){

menuX = cPos.x - offsetX;
menuY = cPos.y - offsetY;
}```
Wow dude thank you so much!

<3 I love you! <3

6. Originally Posted by -Dimensions-
Wow dude thank you so much!

<3 I love you! <3
How hard is that. /fp

7. ## The Following User Says Thank You to Stephen For This Useful Post:

CAFlames (07-22-2011)

8. Originally Posted by Stephen

How hard is that. /fp
I was having a Brain Fart that day.

9. Originally Posted by -Dimensions-
Wow dude thank you so much!

<3 I love you! <3

use it:

Code:
```if (YOURFKHACK == 1)
{
if(GetAsyncKeyState(VK_LBUTTON) < 0)
{

GetCursorPos(&cPos);

if(cPos.x > menuX - 10 && cPos.x < menuX + 125 && cPos.y > menuY - 10 && cPos.y < menuY + 455){

if(!isDragging){

offsetX = cPos.x - menuX;
offsetY = cPos.y - menuY;
isDragging = true;
}
}
} else {

isDragging = false;
}
}
if(isDragging){

menuX = cPos.x - offsetX;
menuY = cPos.y - offsetY;
}```

10. Originally Posted by wicho_koz
use it:

Code:
```if (YOURFKHACK == 1)
{
if(GetAsyncKeyState(VK_LBUTTON) < 0)
{

GetCursorPos(&cPos);

if(cPos.x > menuX - 10 && cPos.x < menuX + 125 && cPos.y > menuY - 10 && cPos.y < menuY + 455){

if(!isDragging){

offsetX = cPos.x - menuX;
offsetY = cPos.y - menuY;
isDragging = true;
}
}
} else {

isDragging = false;
}
}
if(isDragging){

menuX = cPos.x - offsetX;
menuY = cPos.y - offsetY;
}```

uhm .

11. ## The Following User Says Thank You to Stephen For This Useful Post:

flameswor10 (07-23-2011)

12. Originally Posted by wicho_koz
use it:

Code:
```if (YOURFKHACK == 1)
{
if(GetAsyncKeyState(VK_LBUTTON) < 0)
{

GetCursorPos(&cPos);

if(cPos.x > menuX - 10 && cPos.x < menuX + 125 && cPos.y > menuY - 10 && cPos.y < menuY + 455){

if(!isDragging){

offsetX = cPos.x - menuX;
offsetY = cPos.y - menuY;
isDragging = true;
}
}
} else {

isDragging = false;
}
}
if(isDragging){

menuX = cPos.x - offsetX;
menuY = cPos.y - offsetY;
}```
YouDumbBro?

13. ## The Following User Says Thank You to OBrozz For This Useful Post:

flameswor10 (07-23-2011)

14. flameswor. i feel like that was taken from my base from forever ago?

15. Originally Posted by IcySeal
flameswor. i feel like that was taken from my base from forever ago?
Never touched your base before.
It was in Acidbase

16. AFffffffffffffffFFFFFFFFFFFFFFFFFFFfffffffffffffff fffffffff dragging code is oldddddddddddddddddddddddddd

17. i use the left righ tup and down buttons to move my menu
mine is simple to me hold alt+direction arrow= move menu

18. Originally Posted by flameswor10
Definitions:
Code:
```POINT cPos;
int menuX = 20, menuY = 100, offsetX, offsetY;```
Code:
```	if(GetAsyncKeyState(VK_LBUTTON) < 0)
{

GetCursorPos(&cPos);

if(cPos.x > menuX - 10 && cPos.x < menuX + 125 && cPos.y > menuY - 10 && cPos.y < menuY + 455){

if(!isDragging){

offsetX = cPos.x - menuX;
offsetY = cPos.y - menuY;
isDragging = true;
}
}
} else {

isDragging = false;
}
}
if(isDragging){

menuX = cPos.x - offsetX;
menuY = cPos.y - offsetY;
}```
for some reason that looks exactly like my menu move ..... EXACTLY!

Page 1 of 2 12 Last