improved readability in backfocus()

This commit is contained in:
mrbesen 2017-10-26 13:24:12 +02:00
parent 9fae8551fe
commit 72654bafff
1 changed files with 8 additions and 11 deletions

View File

@ -208,18 +208,16 @@ public class Clicker implements Runnable{
private void backfocus(Robot bot) { private void backfocus(Robot bot) {
if(backfocus) { if(backfocus) {
if(os == OSType.Windows | os == OSType.Linux)
bot.keyPress(KeyEvent.VK_ALT); int alt_key = ( os == OSType.Windows | os == OSType.Linux ? KeyEvent.VK_ALT : KeyEvent.VK_META);
else//osx / unsupported
bot.keyPress(KeyEvent.VK_META); bot.keyPress(alt_key);
bot.keyPress(KeyEvent.VK_TAB); bot.keyPress(KeyEvent.VK_TAB);
sleep(waittime); sleep(waittime);
bot.keyRelease(KeyEvent.VK_TAB); bot.keyRelease(KeyEvent.VK_TAB);
if(os == OSType.Windows | os == OSType.Linux)
bot.keyRelease(KeyEvent.VK_ALT); bot.keyRelease(alt_key);
else//osx / unsupported
bot.keyRelease(KeyEvent.VK_META);
} }
} }
@ -375,7 +373,7 @@ public class Clicker implements Runnable{
arena_view = c; arena_view = c;
break; break;
} }
if(mincolordistance < minimumdistance) if(mincolordistance < minimumdistance)//enlarging min distance required
mincolordistance = minimumdistance; mincolordistance = minimumdistance;
System.out.println(colornum + ": "+c.getRed() + " " + c.getGreen() + " " + c.getBlue()); System.out.println(colornum + ": "+c.getRed() + " " + c.getGreen() + " " + c.getBlue());
} }
@ -396,7 +394,6 @@ public class Clicker implements Runnable{
unsupported unsupported
} }
public static Rectangle getRect(int x, int y) { public static Rectangle getRect(int x, int y) {
return new Rectangle(x-2, y-2, 5, 5); return new Rectangle(x-2, y-2, 5, 5);
} }