more portable shortcut modifier
This commit is contained in:
parent
cb15a6dc17
commit
2e9e024295
@ -13,7 +13,7 @@ Run with:
|
|||||||
|
|
||||||
Controls:
|
Controls:
|
||||||
|
|
||||||
/ - help
|
/ - contextual help
|
||||||
arrows - normal movement
|
arrows - normal movement
|
||||||
control + arrows - fine-grained movement [OS X: command + arrows]
|
control + arrows - fine-grained movement [OS X: command + arrows]
|
||||||
space - pickup/drop
|
space - pickup/drop
|
||||||
@ -23,11 +23,11 @@ Controls:
|
|||||||
R - toggle radio
|
R - toggle radio
|
||||||
P - paintbrush
|
P - paintbrush
|
||||||
T - toolbox
|
T - toolbox
|
||||||
[, ] - rotate
|
[, ] - rotate device
|
||||||
F - flip
|
F - flip
|
||||||
L - load small chip
|
L - load small chip
|
||||||
E - enter room
|
E - enter robot
|
||||||
X - exit room
|
X - exit robot
|
||||||
|
|
||||||
Cheat/debug:
|
Cheat/debug:
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ import java.awt.event.KeyEvent;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
public class Remote extends Item implements Avatar {
|
public class Remote extends Item implements Avatar {
|
||||||
|
private int shortcut_modifier = Toolkit.getDefaultToolkit ().getMenuShortcutKeyMask();
|
||||||
|
|
||||||
public Remote() {
|
public Remote() {
|
||||||
width = 4;
|
width = 4;
|
||||||
height = 20;
|
height = 20;
|
||||||
@ -98,28 +100,28 @@ public class Remote extends Item implements Avatar {
|
|||||||
}
|
}
|
||||||
else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
|
else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
|
||||||
if (carriedBy == null) {
|
if (carriedBy == null) {
|
||||||
moveRight(e.isControlDown());
|
moveRight((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
}
|
}
|
||||||
repeating = 0;
|
repeating = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
|
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
|
||||||
if (carriedBy == null) {
|
if (carriedBy == null) {
|
||||||
moveLeft(e.isControlDown());
|
moveLeft((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
}
|
}
|
||||||
repeating = 0;
|
repeating = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (e.getKeyCode() == KeyEvent.VK_UP) {
|
else if (e.getKeyCode() == KeyEvent.VK_UP) {
|
||||||
if (carriedBy == null) {
|
if (carriedBy == null) {
|
||||||
moveUp(e.isControlDown());
|
moveUp((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
}
|
}
|
||||||
repeating = 0;
|
repeating = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||||
if (carriedBy == null) {
|
if (carriedBy == null) {
|
||||||
moveDown(e.isControlDown());
|
moveDown((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
}
|
}
|
||||||
repeating = 0;
|
repeating = 0;
|
||||||
return true;
|
return true;
|
||||||
@ -134,7 +136,7 @@ public class Remote extends Item implements Avatar {
|
|||||||
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
|
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
|
||||||
repeating++;
|
repeating++;
|
||||||
if (repeating > 10) {
|
if (repeating > 10) {
|
||||||
moveRight(e.isControlDown());
|
moveRight((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -142,7 +144,7 @@ public class Remote extends Item implements Avatar {
|
|||||||
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
|
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
|
||||||
repeating++;
|
repeating++;
|
||||||
if (repeating > 10) {
|
if (repeating > 10) {
|
||||||
moveLeft(e.isControlDown());
|
moveLeft((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -150,7 +152,7 @@ public class Remote extends Item implements Avatar {
|
|||||||
else if (e.getKeyCode() == KeyEvent.VK_UP) {
|
else if (e.getKeyCode() == KeyEvent.VK_UP) {
|
||||||
repeating++;
|
repeating++;
|
||||||
if (repeating > 10) {
|
if (repeating > 10) {
|
||||||
moveUp(e.isControlDown());
|
moveUp((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -158,7 +160,7 @@ public class Remote extends Item implements Avatar {
|
|||||||
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||||
repeating++;
|
repeating++;
|
||||||
if (repeating > 10) {
|
if (repeating > 10) {
|
||||||
moveDown(e.isControlDown());
|
moveDown((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -18,6 +18,7 @@ import java.util.ArrayList;
|
|||||||
public class SolderingPen extends Device implements Avatar {
|
public class SolderingPen extends Device implements Avatar {
|
||||||
private boolean hot;
|
private boolean hot;
|
||||||
private Port currentPort = null; // Port that Soldering pen is currently over
|
private Port currentPort = null; // Port that Soldering pen is currently over
|
||||||
|
private int shortcut_modifier = Toolkit.getDefaultToolkit ().getMenuShortcutKeyMask();
|
||||||
|
|
||||||
public SolderingPen() {
|
public SolderingPen() {
|
||||||
width = 22;
|
width = 22;
|
||||||
@ -313,28 +314,28 @@ public class SolderingPen extends Device implements Avatar {
|
|||||||
}
|
}
|
||||||
else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
|
else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
|
||||||
if (carriedBy == null) {
|
if (carriedBy == null) {
|
||||||
moveRight(e.isControlDown());
|
moveRight((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
}
|
}
|
||||||
repeating = 0;
|
repeating = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
|
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
|
||||||
if (carriedBy == null) {
|
if (carriedBy == null) {
|
||||||
moveLeft(e.isControlDown());
|
moveLeft((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
}
|
}
|
||||||
repeating = 0;
|
repeating = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (e.getKeyCode() == KeyEvent.VK_UP) {
|
else if (e.getKeyCode() == KeyEvent.VK_UP) {
|
||||||
if (carriedBy == null) {
|
if (carriedBy == null) {
|
||||||
moveUp(e.isControlDown());
|
moveUp((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
}
|
}
|
||||||
repeating = 0;
|
repeating = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||||
if (carriedBy == null) {
|
if (carriedBy == null) {
|
||||||
moveDown(e.isControlDown());
|
moveDown((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
}
|
}
|
||||||
repeating = 0;
|
repeating = 0;
|
||||||
return true;
|
return true;
|
||||||
@ -358,7 +359,7 @@ public class SolderingPen extends Device implements Avatar {
|
|||||||
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
|
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
|
||||||
repeating++;
|
repeating++;
|
||||||
if (repeating > 10) {
|
if (repeating > 10) {
|
||||||
moveRight(e.isControlDown());
|
moveRight((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -366,7 +367,7 @@ public class SolderingPen extends Device implements Avatar {
|
|||||||
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
|
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
|
||||||
repeating++;
|
repeating++;
|
||||||
if (repeating > 10) {
|
if (repeating > 10) {
|
||||||
moveLeft(e.isControlDown());
|
moveLeft((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -374,7 +375,7 @@ public class SolderingPen extends Device implements Avatar {
|
|||||||
else if (e.getKeyCode() == KeyEvent.VK_UP) {
|
else if (e.getKeyCode() == KeyEvent.VK_UP) {
|
||||||
repeating++;
|
repeating++;
|
||||||
if (repeating > 10) {
|
if (repeating > 10) {
|
||||||
moveUp(e.isControlDown());
|
moveUp((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -382,7 +383,7 @@ public class SolderingPen extends Device implements Avatar {
|
|||||||
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||||
repeating++;
|
repeating++;
|
||||||
if (repeating > 10) {
|
if (repeating > 10) {
|
||||||
moveDown(e.isControlDown());
|
moveDown((e.getModifiers() & shortcut_modifier) > 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user