use shortcut modifier for command-arrow vs control-arrow on OS X; added a quick key reference to help

This commit is contained in:
Patrick Surry 2014-12-10 20:21:30 -05:00
parent 165e249694
commit cb15a6dc17
2 changed files with 36 additions and 9 deletions

View File

@ -11,6 +11,33 @@ Run with:
java -jar target/dq-1.1-SNAPSHOT.jar java -jar target/dq-1.1-SNAPSHOT.jar
Controls:
/ - help
arrows - normal movement
control + arrows - fine-grained movement [OS X: command + arrows]
space - pickup/drop
C - game cursor
H - hot cursor
S - solder pen
R - toggle radio
P - paintbrush
T - toolbox
[, ] - rotate
F - flip
L - load small chip
E - enter room
X - exit room
Cheat/debug:
shift + arrows - move rooms
M - dump memory usage
Note: On OS X, control + arrow-keys are bound to Apple's "Mission Control". I switched to the 'shortcut' modifier which is control on windows and command on OS X. Alternatively, you can disable
built in OS X shortcuts via System Preferences -> Keyboard -> Shorcuts.
Copyright (c) 2000 Thomas Foote Copyright (c) 2000 Thomas Foote
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining

View File

@ -15,7 +15,7 @@ import java.awt.event.KeyEvent;
public class Player extends Item implements Avatar { public class Player extends Item implements Avatar {
private int keyRepeatRate = 5; private int keyRepeatRate = 5;
private int shortcut_modifier = Toolkit.getDefaultToolkit ().getMenuShortcutKeyMask();
protected boolean handleSaveSmallChip() { protected boolean handleSaveSmallChip() {
return false; return false;
@ -362,16 +362,16 @@ public class Player extends Item implements Avatar {
else if (e.getKeyCode() == KeyEvent.VK_SLASH && handleHelp()) { else if (e.getKeyCode() == KeyEvent.VK_SLASH && handleHelp()) {
return false; return false;
} }
else if (e.getKeyCode() == KeyEvent.VK_RIGHT && handleMoveRight(e.isShiftDown(), e.isControlDown())) { else if (e.getKeyCode() == KeyEvent.VK_RIGHT && handleMoveRight(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) {
return true; return true;
} }
else if (e.getKeyCode() == KeyEvent.VK_LEFT && handleMoveLeft(e.isShiftDown(), e.isControlDown())) { else if (e.getKeyCode() == KeyEvent.VK_LEFT && handleMoveLeft(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) {
return true; return true;
} }
else if (e.getKeyCode() == KeyEvent.VK_UP && handleMoveUp(e.isShiftDown(), e.isControlDown())) { else if (e.getKeyCode() == KeyEvent.VK_UP && handleMoveUp(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) {
return true; return true;
} }
else if (e.getKeyCode() == KeyEvent.VK_DOWN && handleMoveDown(e.isShiftDown(), e.isControlDown())) { else if (e.getKeyCode() == KeyEvent.VK_DOWN && handleMoveDown(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) {
return true; return true;
} }
else if (e.getKeyCode() == KeyEvent.VK_SPACE && handlePickupDrop()) { else if (e.getKeyCode() == KeyEvent.VK_SPACE && handlePickupDrop()) {
@ -455,22 +455,22 @@ public class Player extends Item implements Avatar {
public boolean KeyDown(KeyEvent e) { public boolean KeyDown(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_RIGHT) { if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
if (handleRepeatRight(e.isControlDown())) { if (handleRepeatRight((e.getModifiers() & shortcut_modifier) > 0)) {
return true; return true;
} }
} }
else if (e.getKeyCode() == KeyEvent.VK_LEFT) { else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
if (handleRepeatLeft(e.isControlDown())) { if (handleRepeatLeft((e.getModifiers() & shortcut_modifier) > 0)) {
return true; return true;
} }
} }
else if (e.getKeyCode() == KeyEvent.VK_UP) { else if (e.getKeyCode() == KeyEvent.VK_UP) {
if (handleRepeatUp(e.isControlDown())) { if (handleRepeatUp((e.getModifiers() & shortcut_modifier) > 0)) {
return true; return true;
} }
} }
else if (e.getKeyCode() == KeyEvent.VK_DOWN) { else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
if (handleRepeatDown(e.isControlDown())) { if (handleRepeatDown((e.getModifiers() & shortcut_modifier) > 0)) {
return true; return true;
} }
} }