1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Bouton test = new Bouton();
int x = MouseInfo.getPointerInfo().getLocation().x;
int y = MouseInfo.getPointerInfo().getLocation().y;
int xLoc = test.getLocationOnScreen().x;
int yLoc = test.getLocationOnScreen().y;
if (y < yLoc)
{
//Diag gauche
if(x < xLoc)
{
if(Math.sqrt(((xLoc-x)^2)+((yLoc-y)^2)) <= k)
{
System.out.println("("+x+", "+y+")");
System.out.println(Math.sqrt(((xLoc-x)^2)+((yLoc-y)^2)));
System.out.println("moving diag gauche");
//move(test);
}
}
//Diag Droite
if((x > (xLoc + 200)))
{
System.out.println(Math.sqrt(((xLoc-x)^2)+((yLoc-y)^2)));
}
} |