Skip to content

Commit 2df73da

Browse files
committed
Reimplemented joystick keys after recent physical keyboard event handling changes.
1 parent 79c622f commit 2df73da

2 files changed

Lines changed: 36 additions & 5 deletions

File tree

core/src/main/java/emu/jvic/KeyboardMatrix.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ public abstract class KeyboardMatrix extends InputAdapter {
125125
{ VicKeys.SIX, 128, 4 },
126126
{ VicKeys.FOUR, 128, 2 },
127127
{ VicKeys.TWO, 128, 1 },
128+
129+
{ VicKeys.JOYSTICK_FIRE, JOYSTICK, 0x20 }, // Fire button
130+
{ VicKeys.JOYSTICK_DOWN, JOYSTICK, 0x08 }, // Down
131+
{ VicKeys.JOYSTICK_LEFT, JOYSTICK, 0x10 }, // Left
132+
{ VicKeys.JOYSTICK_RIGHT, JOYSTICK, 0x80 }, // Right
133+
{ VicKeys.JOYSTICK_UP, JOYSTICK, 0x04 }, // Up
134+
{ VicKeys.JOYSTICK_SW, JOYSTICK, 0x18 }, // SW
135+
{ VicKeys.JOYSTICK_SE, JOYSTICK, 0x88 }, // SE
136+
{ VicKeys.JOYSTICK_NW, JOYSTICK, 0x14 }, // NW
137+
{ VicKeys.JOYSTICK_NE, JOYSTICK, 0x84 }, // NE
128138
};
129139

130140
/**

core/src/main/java/emu/jvic/VicKeys.java

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,17 @@ public interface VicKeys {
9595
public static final int LEFT_ARROW = 63;
9696
public static final int ONE = 64;
9797

98+
// Joystick keys.
99+
public static final int JOYSTICK_FIRE = 90;
100+
public static final int JOYSTICK_LEFT = 91;
101+
public static final int JOYSTICK_RIGHT = 92;
102+
public static final int JOYSTICK_UP = 93;
103+
public static final int JOYSTICK_DOWN = 94;
104+
public static final int JOYSTICK_NW = 95;
105+
public static final int JOYSTICK_NE = 96;
106+
public static final int JOYSTICK_SW = 97;
107+
public static final int JOYSTICK_SE = 98;
108+
98109
// Special code that instructs keyboard matrix to clear shift status.
99110
public static final int NO_SHIFT = 99;
100111

@@ -211,12 +222,12 @@ public interface VicKeys {
211222
{ Keys.SHIFT_LEFT, VicKeys.LEFT_SHIFT },
212223
{ Keys.SHIFT_RIGHT, VicKeys.RIGHT_SHIFT },
213224
{ Keys.CONTROL_LEFT, VicKeys.CONTROL },
214-
{ Keys.LEFT, VicKeys.LEFT_SHIFT, VicKeys.CURSOR_RIGHT },
215-
{ Keys.UP, VicKeys.LEFT_SHIFT, VicKeys.CURSOR_DOWN },
216-
{ Keys.DOWN, VicKeys.CURSOR_DOWN },
217-
{ Keys.RIGHT, VicKeys.CURSOR_RIGHT },
225+
{ Keys.LEFT, VicKeys.LEFT_SHIFT, VicKeys.CURSOR_RIGHT, VicKeys.JOYSTICK_LEFT },
226+
{ Keys.UP, VicKeys.LEFT_SHIFT, VicKeys.CURSOR_DOWN, VicKeys.JOYSTICK_UP },
227+
{ Keys.DOWN, VicKeys.CURSOR_DOWN, VicKeys.JOYSTICK_DOWN },
228+
{ Keys.RIGHT, VicKeys.CURSOR_RIGHT, VicKeys.JOYSTICK_RIGHT },
218229
{ Keys.HOME, VicKeys.HOME },
219-
{ Keys.INSERT, VicKeys.LEFT_SHIFT, VicKeys.DELETE },
230+
{ Keys.INSERT, VicKeys.LEFT_SHIFT, VicKeys.DELETE, VicKeys.JOYSTICK_FIRE },
220231
{ Keys.ESCAPE, VicKeys.RUN_STOP },
221232
{ Keys.F1, VicKeys.F1 },
222233
{ Keys.F2, VicKeys.LEFT_SHIFT, VicKeys.F1 },
@@ -226,5 +237,15 @@ public interface VicKeys {
226237
{ Keys.F6, VicKeys.LEFT_SHIFT, VicKeys.F5 },
227238
{ Keys.F7, VicKeys.F7 },
228239
{ Keys.F8, VicKeys.LEFT_SHIFT, VicKeys.F7 },
240+
241+
{ Keys.NUMPAD_0, VicKeys.JOYSTICK_FIRE }, // Fire button
242+
{ Keys.NUMPAD_1, VicKeys.JOYSTICK_SW }, // SW
243+
{ Keys.NUMPAD_2, VicKeys.JOYSTICK_DOWN }, // Down
244+
{ Keys.NUMPAD_3, VicKeys.JOYSTICK_SE }, // SE
245+
{ Keys.NUMPAD_4, VicKeys.JOYSTICK_LEFT }, // Left
246+
{ Keys.NUMPAD_6, VicKeys.JOYSTICK_RIGHT }, // Right
247+
{ Keys.NUMPAD_7, VicKeys.JOYSTICK_NW }, // NW
248+
{ Keys.NUMPAD_8, VicKeys.JOYSTICK_UP }, // Up
249+
{ Keys.NUMPAD_9, VicKeys.JOYSTICK_NE }, // NE
229250
};
230251
}

0 commit comments

Comments
 (0)