From 5667ab5e1cd7ea041f25b72b19dcc4380e656524 Mon Sep 17 00:00:00 2001 From: lantzelot-swe <75668734+lantzelot-swe@users.noreply.github.com> Date: Sat, 11 Nov 2023 00:20:06 +0100 Subject: [PATCH] feat: add THEGamepad to the "edit controller" dialog --- src/main/java/se/lantz/gui/BaseDialog.java | 2 +- .../se/lantz/gui/gamepad/GamePadDialog.java | 41 +++- ...el.java => TheGamepadBackgroundPanel.java} | 22 +- .../gui/gamepad/TheGamepadImagePanel.java | 129 ++++++++++ .../gui/gamepad/TheGamepadInfoPanel.java | 77 ++++++ .../gamepad/TheGamepadMappingComponent.java | 220 ++++++++++++++++++ .../gui/gamepad/TheGamepadMappingPanel.java | 163 +++++++++++++ .../gamepad/USBControllerBackgroundPanel.java | 66 ++++++ ...anel.java => USBControllerImagePanel.java} | 12 +- ...Panel.java => USBControllerInfoPanel.java} | 4 +- ...ava => USBControllerMappingComponent.java} | 12 +- ...el.java => USBControllerMappingPanel.java} | 98 ++++---- src/main/resources/se/lantz/TheGamepad.png | Bin 0 -> 42961 bytes .../resources/se/lantz/TheGamepadMapping.png | Bin 0 -> 4098 bytes 14 files changed, 763 insertions(+), 83 deletions(-) rename src/main/java/se/lantz/gui/gamepad/{GamepadBackgroundPanel.java => TheGamepadBackgroundPanel.java} (75%) create mode 100644 src/main/java/se/lantz/gui/gamepad/TheGamepadImagePanel.java create mode 100644 src/main/java/se/lantz/gui/gamepad/TheGamepadInfoPanel.java create mode 100644 src/main/java/se/lantz/gui/gamepad/TheGamepadMappingComponent.java create mode 100644 src/main/java/se/lantz/gui/gamepad/TheGamepadMappingPanel.java create mode 100644 src/main/java/se/lantz/gui/gamepad/USBControllerBackgroundPanel.java rename src/main/java/se/lantz/gui/gamepad/{GamePadImagePanel.java => USBControllerImagePanel.java} (92%) rename src/main/java/se/lantz/gui/gamepad/{GamePadInfoPanel.java => USBControllerInfoPanel.java} (97%) rename src/main/java/se/lantz/gui/gamepad/{MappingComponent.java => USBControllerMappingComponent.java} (93%) rename src/main/java/se/lantz/gui/gamepad/{GamePadMappingPanel.java => USBControllerMappingPanel.java} (60%) create mode 100644 src/main/resources/se/lantz/TheGamepad.png create mode 100644 src/main/resources/se/lantz/TheGamepadMapping.png diff --git a/src/main/java/se/lantz/gui/BaseDialog.java b/src/main/java/se/lantz/gui/BaseDialog.java index ec9fe85..63ff25b 100644 --- a/src/main/java/se/lantz/gui/BaseDialog.java +++ b/src/main/java/se/lantz/gui/BaseDialog.java @@ -51,7 +51,7 @@ public class BaseDialog extends JDialog getRootPane().setDefaultButton(getOkButton()); } - protected void addContent(JPanel panel) + protected void addContent(JComponent panel) { getBackgroundPanel().add(panel, BorderLayout.CENTER); } diff --git a/src/main/java/se/lantz/gui/gamepad/GamePadDialog.java b/src/main/java/se/lantz/gui/gamepad/GamePadDialog.java index 0591570..9df8e6b 100644 --- a/src/main/java/se/lantz/gui/gamepad/GamePadDialog.java +++ b/src/main/java/se/lantz/gui/gamepad/GamePadDialog.java @@ -3,39 +3,64 @@ package se.lantz.gui.gamepad; import java.awt.Dimension; import java.awt.Frame; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; + import se.lantz.gui.BaseDialog; import se.lantz.model.JoystickModel; public class GamePadDialog extends BaseDialog { - private GamepadBackgroundPanel panel; + private JTabbedPane tabbedPane; + private USBControllerBackgroundPanel usbControlerBackroundPanel; + private TheGamepadBackgroundPanel theGamePadBackroundPanel; private JoystickModel model; - private Dimension dialogSize = new Dimension(660, 790); + private Dimension dialogSize = new Dimension(660, 810); public GamePadDialog(Frame owner, JoystickModel model) { super(owner); //Create a separate model so that changes can be cancelled this.model = new JoystickModel(model.isPort1()); - setTitle("Edit joystick/gamepad configuration"); - addContent(getGamepadBackgroundPanel()); + setTitle("Edit THEGamepad/USB Controller configuration"); + addContent(getTabbedPane()); this.setPreferredSize(dialogSize); this.setResizable(false); //Set initial values to the model this.model.setConfigStringFromDb(model.getConfigString()); } - private GamepadBackgroundPanel getGamepadBackgroundPanel() + private USBControllerBackgroundPanel getUSBControllerBackgroundPanel() { - if (panel == null) + if (usbControlerBackroundPanel == null) { - panel = new GamepadBackgroundPanel(model); + usbControlerBackroundPanel = new USBControllerBackgroundPanel(model); } - return panel; + return usbControlerBackroundPanel; + } + + private TheGamepadBackgroundPanel getTheGamepadBackgroundPanel() + { + if (theGamePadBackroundPanel == null) + { + theGamePadBackroundPanel = new TheGamepadBackgroundPanel(model); + } + return theGamePadBackroundPanel; } public String getJoyConfigString() { return this.model.getConfigString(); } + + private JTabbedPane getTabbedPane() + { + if (tabbedPane == null) + { + tabbedPane = new JTabbedPane(); + tabbedPane.addTab("THEGamepad", getTheGamepadBackgroundPanel()); + tabbedPane.addTab("Alternative USB controller", getUSBControllerBackgroundPanel()); + } + return tabbedPane; + } } diff --git a/src/main/java/se/lantz/gui/gamepad/GamepadBackgroundPanel.java b/src/main/java/se/lantz/gui/gamepad/TheGamepadBackgroundPanel.java similarity index 75% rename from src/main/java/se/lantz/gui/gamepad/GamepadBackgroundPanel.java rename to src/main/java/se/lantz/gui/gamepad/TheGamepadBackgroundPanel.java index 495790a..ddf06a9 100644 --- a/src/main/java/se/lantz/gui/gamepad/GamepadBackgroundPanel.java +++ b/src/main/java/se/lantz/gui/gamepad/TheGamepadBackgroundPanel.java @@ -8,13 +8,13 @@ import javax.swing.JPanel; import se.lantz.model.JoystickModel; -public class GamepadBackgroundPanel extends JPanel +public class TheGamepadBackgroundPanel extends JPanel { - private GamePadInfoPanel gamePadInfoPanel; - private GamePadImagePanel gamePadImagePanel; - private GamePadMappingPanel gamePadMappingPanel; + private TheGamepadInfoPanel gamePadInfoPanel; + private TheGamepadImagePanel gamePadImagePanel; + private TheGamepadMappingPanel gamePadMappingPanel; private JoystickModel model; - public GamepadBackgroundPanel(JoystickModel model) { + public TheGamepadBackgroundPanel(JoystickModel model) { this.model = model; GridBagLayout gridBagLayout = new GridBagLayout(); setLayout(gridBagLayout); @@ -45,21 +45,21 @@ public class GamepadBackgroundPanel extends JPanel gbc_gamePadMappingPanel.gridy = 1; add(getGamePadMappingPanel(), gbc_gamePadMappingPanel); } - private GamePadInfoPanel getGamePadInfoPanel() { + private TheGamepadInfoPanel getGamePadInfoPanel() { if (gamePadInfoPanel == null) { - gamePadInfoPanel = new GamePadInfoPanel(); + gamePadInfoPanel = new TheGamepadInfoPanel(); } return gamePadInfoPanel; } - private GamePadImagePanel getGamePadImagePanel() { + private TheGamepadImagePanel getGamePadImagePanel() { if (gamePadImagePanel == null) { - gamePadImagePanel = new GamePadImagePanel(); + gamePadImagePanel = new TheGamepadImagePanel(); } return gamePadImagePanel; } - private GamePadMappingPanel getGamePadMappingPanel() { + private TheGamepadMappingPanel getGamePadMappingPanel() { if (gamePadMappingPanel == null) { - gamePadMappingPanel = new GamePadMappingPanel(model, getGamePadImagePanel()); + gamePadMappingPanel = new TheGamepadMappingPanel(model, getGamePadImagePanel()); } return gamePadMappingPanel; } diff --git a/src/main/java/se/lantz/gui/gamepad/TheGamepadImagePanel.java b/src/main/java/se/lantz/gui/gamepad/TheGamepadImagePanel.java new file mode 100644 index 0000000..e60b846 --- /dev/null +++ b/src/main/java/se/lantz/gui/gamepad/TheGamepadImagePanel.java @@ -0,0 +1,129 @@ +package se.lantz.gui.gamepad; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; + +import javax.swing.ImageIcon; +import javax.swing.JLabel; +import javax.swing.JPanel; + +public class TheGamepadImagePanel extends JPanel +{ + public enum TheGamepadButton + { + UP("Up", Character.toString(0x1f815)), DOWN("Down", Character.toString(0x1f817)), + LEFT("Left", Character.toString(0x1f814)), RIGHT("Right", Character.toString(0x1f816)), A("A", "TL"), B("B", "Right Fire"), + X("X", "TR"), Y("Y", "Left Fire"), LSB("LSB", "A"), RSB("RSB", "B"), MENU("Menu", "C"); + + public final String label; + public final String joyMapping; + + private TheGamepadButton(String label, String joyMapping) + { + this.label = label; + this.joyMapping = joyMapping; + } + } + + ImageIcon gamepadImage = new ImageIcon(getClass().getResource("/se/lantz/TheGamepad.png")); + private JLabel imageLabel; + + private TheGamepadButton currentButton = null; + + public TheGamepadImagePanel() + { + GridBagLayout gridBagLayout = new GridBagLayout(); + setLayout(gridBagLayout); + GridBagConstraints gbc_imageLabel = new GridBagConstraints(); + gbc_imageLabel.insets = new Insets(20, 0, 0, 0); + gbc_imageLabel.weightx = 1.0; + gbc_imageLabel.weighty = 1.0; + gbc_imageLabel.anchor = GridBagConstraints.NORTH; + gbc_imageLabel.gridx = 0; + gbc_imageLabel.gridy = 0; + add(getImageLabel(), gbc_imageLabel); + } + + private JLabel getImageLabel() + { + if (imageLabel == null) + { + imageLabel = new JLabel() + { + + @Override + protected void paintComponent(Graphics g) + { + super.paintComponent(g); + //Draw for currently focused button + drawForButton(g); + } + + }; + imageLabel.setIcon(gamepadImage); + } + return imageLabel; + } + + public void setCurrentButtonAndRepaint(TheGamepadButton button) + { + this.currentButton = button; + this.repaint(); + } + + private void drawForButton(Graphics g) + { + if (currentButton == null) + { + return; + } + + Graphics2D graphics2D = (Graphics2D) g; + graphics2D.setStroke(new BasicStroke(3.0f)); + graphics2D.setColor(Color.red); + + switch (currentButton) + { + case UP: + graphics2D.drawOval(55, 50, 22, 22); + break; + case DOWN: + graphics2D.drawOval(53, 84, 22, 22); + break; + case LEFT: + graphics2D.drawOval(40, 66, 22, 22); + break; + case RIGHT: + graphics2D.drawOval(72, 66, 22, 22); + break; + case A: + graphics2D.drawOval(253, 89, 22, 22); + break; + case B: + graphics2D.drawOval(276, 68, 22, 22); + break; + case MENU: + graphics2D.drawRect(122, 92, 25, 25); + break; + case LSB: + graphics2D.drawRect(47, 15, 25, 20); + break; + case RSB: + graphics2D.drawRect(253, 15, 25, 20); + break; + case X: + graphics2D.drawOval(230, 67, 22, 22); + break; + case Y: + graphics2D.drawOval(250, 46, 22, 22); + break; + default: + break; + } + } +} diff --git a/src/main/java/se/lantz/gui/gamepad/TheGamepadInfoPanel.java b/src/main/java/se/lantz/gui/gamepad/TheGamepadInfoPanel.java new file mode 100644 index 0000000..b5ec7c1 --- /dev/null +++ b/src/main/java/se/lantz/gui/gamepad/TheGamepadInfoPanel.java @@ -0,0 +1,77 @@ +package se.lantz.gui.gamepad; + +import java.awt.Color; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; + +import javax.swing.ImageIcon; +import javax.swing.JLabel; +import javax.swing.JPanel; + +public class TheGamepadInfoPanel extends JPanel +{ + ImageIcon compImage = new ImageIcon(getClass().getResource("/se/lantz/TheGamepadMapping.png")); + + private JLabel infoLabel; + private JLabel compImageLabel; + private JLabel extraButtonsInfoLabel; + + public TheGamepadInfoPanel() + { + setBackground(Color.WHITE); + GridBagLayout gridBagLayout = new GridBagLayout(); + setLayout(gridBagLayout); + GridBagConstraints gbc_infoLabel = new GridBagConstraints(); + gbc_infoLabel.fill = GridBagConstraints.HORIZONTAL; + gbc_infoLabel.weightx = 1.0; + gbc_infoLabel.insets = new Insets(0, 10, 0, 10); + gbc_infoLabel.gridx = 0; + gbc_infoLabel.gridy = 0; + add(getInfoLabel(), gbc_infoLabel); + GridBagConstraints gbc_compImageLabel = new GridBagConstraints(); + gbc_compImageLabel.insets = new Insets(0, 0, 10, 0); + gbc_compImageLabel.weighty = 1.0; + gbc_compImageLabel.weightx = 1.0; + gbc_compImageLabel.gridx = 0; + gbc_compImageLabel.gridy = 1; + add(getCompImageLabel(), gbc_compImageLabel); + GridBagConstraints gbc_extraButtonsInfoLabel = new GridBagConstraints(); + gbc_extraButtonsInfoLabel.insets = new Insets(0, 10, 10, 10); + gbc_extraButtonsInfoLabel.fill = GridBagConstraints.HORIZONTAL; + gbc_extraButtonsInfoLabel.gridx = 0; + gbc_extraButtonsInfoLabel.gridy = 2; + add(getExtraButtonsInfoLabel(), gbc_extraButtonsInfoLabel); + } + + private JLabel getInfoLabel() + { + if (infoLabel == null) + { + infoLabel = + new JLabel("
THEGamepad from Retro Games is compatible with THEC64, THEC64 Mini, THEA500 Mini, PC, Mac & Linux. Compared with THEC64 Joystick, functions translate as follows: ddzvtD0mkTUA}{!KzE_
zTf~_PN>HRgij>LxTl=#JTu7kpH6!C;r6W+((un|#ML!-WIKFJ24m_bTbTQU_7>?m=
z%t2mZbwZ32QjmmzJD4!eJ;`>#DO=p>Y$}UIFuaFvsF4*l0QbNrT7{9@<+e9w?R8JK
zMt*R65*u~wWl5t`waiKM9WoFH(*XfimO*jyDnMRp%58UJi<}H5mOEeZx!&?6qsa&t
zWH3w=WX;&;fsUW*{1n@1G^YE?cKtED{Wil}&94~q!BWiev}a5wYO553*VE|RDD3t4
z>+2ii(eQV^dHKqfD@iap#5*Pj9C+i#&FM^*Z_H06a~XZrD_dOL);z}AJRa-}Iubpp
zqP)DmwzgyMUK_>*4z3wJ_>4*>gC#&b8jXjeL;VB8gM;u`-l8-d)ire$l~tTsp=|U#
zy2|4|`IM7CdFiDmpL{Yr*?e!i$bf0Nx~fW-ny9Y1sR@hr!NI;vI)zs7Ndf4Q*A>wg
zs4wewInOxx V&Vxr_p4Lh{`t0j?%us+LvcjrOVWdV4V3t54XrOTIj~UjY5ND(CD9=SM
zljOn&pN8TDjxbjoyf)1T{V-~1DReLV!{_z7JszirD{(2xZc-qMGg1Ju6=?cIXu7O&
zG+b;38dZjxqM(3~j|ZO
");
+ }
+ return infoLabel;
+ }
+
+ private JLabel getCompImageLabel()
+ {
+ if (compImageLabel == null)
+ {
+ compImageLabel = new JLabel();
+ compImageLabel.setBackground(Color.WHITE);
+ compImageLabel.setIcon(compImage);
+ }
+ return compImageLabel;
+ }
+
+ private JLabel getExtraButtonsInfoLabel()
+ {
+ if (extraButtonsInfoLabel == null)
+ {
+ extraButtonsInfoLabel =
+ new JLabel("
Below are the functions for THEC64 Joystick shown in parenthesis for comparison.
");
+ }
+ return extraButtonsInfoLabel;
+ }
+}
diff --git a/src/main/java/se/lantz/gui/gamepad/TheGamepadMappingComponent.java b/src/main/java/se/lantz/gui/gamepad/TheGamepadMappingComponent.java
new file mode 100644
index 0000000..c1e2e59
--- /dev/null
+++ b/src/main/java/se/lantz/gui/gamepad/TheGamepadMappingComponent.java
@@ -0,0 +1,220 @@
+package se.lantz.gui.gamepad;
+
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.KeyboardFocusManager;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.beans.Beans;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+import se.lantz.gui.KeySelectionComboBox;
+import se.lantz.gui.gamepad.TheGamepadImagePanel.TheGamepadButton;
+import se.lantz.model.JoystickModel;
+
+public class TheGamepadMappingComponent extends JPanel
+{
+ private JLabel buttonTextLabel;
+ private KeySelectionComboBox keySelectionComboBox;
+ private JLabel joyMapLabel;
+ private TheGamepadButton button;
+ private JoystickModel model;
+ private TheGamepadImagePanel imagePanel;
+
+ public TheGamepadMappingComponent(TheGamepadButton button, JoystickModel model, TheGamepadImagePanel imagePanel)
+ {
+ this.button = button;
+ this.model = model;
+ this.imagePanel = imagePanel;
+ GridBagLayout gridBagLayout = new GridBagLayout();
+ setLayout(gridBagLayout);
+ GridBagConstraints gbc_buttonTextLabel = new GridBagConstraints();
+ gbc_buttonTextLabel.anchor = GridBagConstraints.WEST;
+ gbc_buttonTextLabel.insets = new Insets(5, 5, 0, 5);
+ gbc_buttonTextLabel.gridx = 0;
+ gbc_buttonTextLabel.gridy = 0;
+ add(getButtonTextLabel(), gbc_buttonTextLabel);
+ GridBagConstraints gbc_keySelectionComboBox = new GridBagConstraints();
+ gbc_keySelectionComboBox.weighty = 1.0;
+ gbc_keySelectionComboBox.gridwidth = 2;
+ gbc_keySelectionComboBox.insets = new Insets(0, 4, 5, 5);
+ gbc_keySelectionComboBox.anchor = GridBagConstraints.NORTHWEST;
+ gbc_keySelectionComboBox.gridx = 0;
+ gbc_keySelectionComboBox.gridy = 1;
+ add(getKeySelectionComboBox(), gbc_keySelectionComboBox);
+ GridBagConstraints gbc_joyMapLabel = new GridBagConstraints();
+ gbc_joyMapLabel.anchor = GridBagConstraints.WEST;
+ gbc_joyMapLabel.weightx = 1.0;
+ gbc_joyMapLabel.insets = new Insets(5, 0, 0, 5);
+ gbc_joyMapLabel.gridx = 1;
+ gbc_joyMapLabel.gridy = 0;
+ add(getJoyMapLabel(), gbc_joyMapLabel);
+
+ if (!Beans.isDesignTime())
+ {
+ model.addPropertyChangeListener((e) -> modelChanged());
+ }
+ }
+
+ private void modelChanged()
+ {
+ switch (button)
+ {
+ case UP:
+ getKeySelectionComboBox().setSelectedCode(model.getUp());
+ break;
+ case DOWN:
+ getKeySelectionComboBox().setSelectedCode(model.getDown());
+ break;
+ case LEFT:
+ getKeySelectionComboBox().setSelectedCode(model.getLeft());
+ break;
+ case RIGHT:
+ getKeySelectionComboBox().setSelectedCode(model.getRight());
+ break;
+ case Y:
+ getKeySelectionComboBox().setSelectedCode(model.getLeftFire());
+ break;
+ case B:
+ getKeySelectionComboBox().setSelectedCode(model.getRightFire());
+ break;
+ case A:
+ getKeySelectionComboBox().setSelectedCode(model.getTl());
+ break;
+ case X:
+ getKeySelectionComboBox().setSelectedCode(model.getTr());
+ break;
+ case LSB:
+ getKeySelectionComboBox().setSelectedCode(model.getA());
+ break;
+ case RSB:
+ getKeySelectionComboBox().setSelectedCode(model.getB());
+ break;
+ case MENU:
+ getKeySelectionComboBox().setSelectedCode(model.getC());
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ private JLabel getButtonTextLabel()
+ {
+ if (buttonTextLabel == null)
+ {
+ buttonTextLabel = new JLabel(button.label);
+ }
+ return buttonTextLabel;
+ }
+
+ private KeySelectionComboBox getKeySelectionComboBox()
+ {
+ if (keySelectionComboBox == null)
+ {
+ keySelectionComboBox = new KeySelectionComboBox(model);
+ keySelectionComboBox.addActionListener(e -> {
+ switch (button)
+ {
+ case UP:
+ model.setUp(keySelectionComboBox.getSelectedCode());
+ break;
+ case DOWN:
+ model.setDown(keySelectionComboBox.getSelectedCode());
+ break;
+ case LEFT:
+ model.setLeft(keySelectionComboBox.getSelectedCode());
+ break;
+ case RIGHT:
+ model.setRight(keySelectionComboBox.getSelectedCode());
+ break;
+ case Y:
+ model.setLeftFire(keySelectionComboBox.getSelectedCode());
+ break;
+ case B:
+ model.setRightFire(keySelectionComboBox.getSelectedCode());
+ break;
+ case A:
+ model.setTl(keySelectionComboBox.getSelectedCode());
+ break;
+ case X:
+ model.setTr(keySelectionComboBox.getSelectedCode());
+ break;
+ case LSB:
+ model.setA(keySelectionComboBox.getSelectedCode());
+ break;
+ case RSB:
+ model.setB(keySelectionComboBox.getSelectedCode());
+ break;
+ case MENU:
+ model.setC(keySelectionComboBox.getSelectedCode());
+ break;
+ default:
+ break;
+ }
+ });
+ keySelectionComboBox.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mouseExited(MouseEvent e)
+ {
+ if (!keySelectionComboBox.hasFocus())
+ {
+ Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+ if (focusOwner instanceof KeySelectionComboBox)
+ {
+ TheGamepadMappingComponent focusedMappingComponent = (TheGamepadMappingComponent) SwingUtilities
+ .getAncestorOfClass(TheGamepadMappingComponent.class, focusOwner);
+ if (focusedMappingComponent != null)
+ {
+ imagePanel.setCurrentButtonAndRepaint(focusedMappingComponent.button);
+ }
+ }
+ else
+ {
+ imagePanel.setCurrentButtonAndRepaint(null);
+ }
+ }
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent me)
+ {
+ imagePanel.setCurrentButtonAndRepaint(button);
+ }
+ });
+ keySelectionComboBox.addFocusListener(new FocusAdapter()
+ {
+ @Override
+ public void focusGained(FocusEvent e)
+ {
+ imagePanel.setCurrentButtonAndRepaint(button);
+ }
+
+ @Override
+ public void focusLost(FocusEvent e)
+ {
+ imagePanel.setCurrentButtonAndRepaint(null);
+ }
+ });
+ }
+ return keySelectionComboBox;
+ }
+
+ private JLabel getJoyMapLabel()
+ {
+ if (joyMapLabel == null)
+ {
+ joyMapLabel = new JLabel("(" + button.joyMapping + ")");
+ }
+ return joyMapLabel;
+ }
+
+}
diff --git a/src/main/java/se/lantz/gui/gamepad/TheGamepadMappingPanel.java b/src/main/java/se/lantz/gui/gamepad/TheGamepadMappingPanel.java
new file mode 100644
index 0000000..044c8b3
--- /dev/null
+++ b/src/main/java/se/lantz/gui/gamepad/TheGamepadMappingPanel.java
@@ -0,0 +1,163 @@
+package se.lantz.gui.gamepad;
+
+import java.awt.GridBagLayout;
+
+import javax.swing.JPanel;
+
+import se.lantz.gui.gamepad.TheGamepadImagePanel.TheGamepadButton;
+import se.lantz.gui.gamepad.USBControllerImagePanel.USBControllerButton;
+import se.lantz.model.JoystickModel;
+import java.awt.GridBagConstraints;
+import java.awt.Insets;
+
+public class TheGamepadMappingPanel extends JPanel
+{
+ private TheGamepadMappingComponent upComponent;
+ private JoystickModel model;
+ private TheGamepadMappingComponent downComponent;
+ private TheGamepadMappingComponent leftComponent;
+ private TheGamepadMappingComponent rightComponent;
+ private TheGamepadMappingComponent xComponent;
+ private TheGamepadMappingComponent yComponent;
+ private TheGamepadMappingComponent aComponent;
+ private TheGamepadMappingComponent bComponent;
+ private TheGamepadMappingComponent leftTriggerComponent;
+ private TheGamepadMappingComponent rightTriggerComponent;
+ private TheGamepadMappingComponent backGuideComponent;
+ private TheGamepadMappingComponent leftShoulderComponent;
+ private TheGamepadMappingComponent rightShoulderComponent;
+ private TheGamepadMappingComponent leftStickComponent;
+ private TheGamepadMappingComponent rightStickComponent;
+ private TheGamepadImagePanel imagePanel;
+
+ public TheGamepadMappingPanel(JoystickModel model, TheGamepadImagePanel imagePanel)
+ {
+ this.model = model;
+ this.imagePanel = imagePanel;
+ GridBagLayout gridBagLayout = new GridBagLayout();
+ gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 1.0};
+ gridBagLayout.columnWeights = new double[]{1.0, 1.0};
+ setLayout(gridBagLayout);
+ GridBagConstraints gbc_upComponent = new GridBagConstraints();
+ gbc_upComponent.fill = GridBagConstraints.BOTH;
+ gbc_upComponent.gridx = 0;
+ gbc_upComponent.gridy = 0;
+ add(getUpComponent(), gbc_upComponent);
+ GridBagConstraints gbc_downgComponent = new GridBagConstraints();
+ gbc_downgComponent.fill = GridBagConstraints.BOTH;
+ gbc_downgComponent.gridx = 0;
+ gbc_downgComponent.gridy = 1;
+ add(getDowngComponent(), gbc_downgComponent);
+ GridBagConstraints gbc_leftComponent = new GridBagConstraints();
+ gbc_leftComponent.fill = GridBagConstraints.BOTH;
+ gbc_leftComponent.gridx = 0;
+ gbc_leftComponent.gridy = 2;
+ add(getMappingComponent_2(), gbc_leftComponent);
+ GridBagConstraints gbc_rightComponent = new GridBagConstraints();
+ gbc_rightComponent.fill = GridBagConstraints.BOTH;
+ gbc_rightComponent.gridx = 0;
+ gbc_rightComponent.gridy = 3;
+ add(getRightComponent(), gbc_rightComponent);
+ GridBagConstraints gbc_xComponent = new GridBagConstraints();
+ gbc_xComponent.fill = GridBagConstraints.BOTH;
+ gbc_xComponent.gridx = 1;
+ gbc_xComponent.gridy = 2;
+ add(getXComponent(), gbc_xComponent);
+ GridBagConstraints gbc_yComponent = new GridBagConstraints();
+ gbc_yComponent.fill = GridBagConstraints.BOTH;
+ gbc_yComponent.gridx = 1;
+ gbc_yComponent.gridy = 3;
+ add(getYComponent(), gbc_yComponent);
+ GridBagConstraints gbc_aComponent = new GridBagConstraints();
+ gbc_aComponent.fill = GridBagConstraints.BOTH;
+ gbc_aComponent.gridx = 1;
+ gbc_aComponent.gridy = 0;
+ add(getAComponent(), gbc_aComponent);
+ GridBagConstraints gbc_bComponent = new GridBagConstraints();
+ gbc_bComponent.fill = GridBagConstraints.BOTH;
+ gbc_bComponent.gridx = 1;
+ gbc_bComponent.gridy = 1;
+ add(getBComponent(), gbc_bComponent);
+ GridBagConstraints gbc_leftTriggerComponent = new GridBagConstraints();
+ gbc_leftTriggerComponent.fill = GridBagConstraints.BOTH;
+ gbc_leftTriggerComponent.gridx = 0;
+ gbc_leftTriggerComponent.gridy = 4;
+ add(getLeftTriggerComponent(), gbc_leftTriggerComponent);
+ GridBagConstraints gbc_rightTriggerComponent = new GridBagConstraints();
+ gbc_rightTriggerComponent.fill = GridBagConstraints.BOTH;
+ gbc_rightTriggerComponent.gridx = 1;
+ gbc_rightTriggerComponent.gridy = 4;
+ add(getRightTriggerComponent(), gbc_rightTriggerComponent);
+ GridBagConstraints gbc_backGuideComponent = new GridBagConstraints();
+ gbc_backGuideComponent.fill = GridBagConstraints.BOTH;
+ gbc_backGuideComponent.gridx = 0;
+ gbc_backGuideComponent.gridy = 5;
+ add(getBackGuideComponent(), gbc_backGuideComponent);
+ }
+ private TheGamepadMappingComponent getUpComponent() {
+ if (upComponent == null) {
+ upComponent = new TheGamepadMappingComponent(TheGamepadButton.UP, model, imagePanel);
+ }
+ return upComponent;
+ }
+ private TheGamepadMappingComponent getDowngComponent() {
+ if (downComponent == null) {
+ downComponent = new TheGamepadMappingComponent(TheGamepadButton.DOWN, model, imagePanel);
+ }
+ return downComponent;
+ }
+ private TheGamepadMappingComponent getMappingComponent_2() {
+ if (leftComponent == null) {
+ leftComponent = new TheGamepadMappingComponent(TheGamepadButton.LEFT, model, imagePanel);
+ }
+ return leftComponent;
+ }
+ private TheGamepadMappingComponent getRightComponent() {
+ if (rightComponent == null) {
+ rightComponent = new TheGamepadMappingComponent(TheGamepadButton.RIGHT, model, imagePanel);
+ }
+ return rightComponent;
+ }
+ private TheGamepadMappingComponent getXComponent() {
+ if (xComponent == null) {
+ xComponent = new TheGamepadMappingComponent(TheGamepadButton.X, model, imagePanel);
+ }
+ return xComponent;
+ }
+ private TheGamepadMappingComponent getYComponent() {
+ if (yComponent == null) {
+ yComponent = new TheGamepadMappingComponent(TheGamepadButton.Y, model, imagePanel);
+ }
+ return yComponent;
+ }
+ private TheGamepadMappingComponent getAComponent() {
+ if (aComponent == null) {
+ aComponent = new TheGamepadMappingComponent(TheGamepadButton.A, model, imagePanel);
+ }
+ return aComponent;
+ }
+ private TheGamepadMappingComponent getBComponent() {
+ if (bComponent == null) {
+ bComponent = new TheGamepadMappingComponent(TheGamepadButton.B, model, imagePanel);
+ }
+ return bComponent;
+ }
+ private TheGamepadMappingComponent getLeftTriggerComponent() {
+ if (leftTriggerComponent == null) {
+ leftTriggerComponent = new TheGamepadMappingComponent(TheGamepadButton.LSB, model, imagePanel);
+ }
+ return leftTriggerComponent;
+ }
+ private TheGamepadMappingComponent getRightTriggerComponent() {
+ if (rightTriggerComponent == null) {
+ rightTriggerComponent = new TheGamepadMappingComponent(TheGamepadButton.RSB, model, imagePanel);
+ }
+ return rightTriggerComponent;
+ }
+ private TheGamepadMappingComponent getBackGuideComponent() {
+ if (backGuideComponent == null) {
+ backGuideComponent = new TheGamepadMappingComponent(TheGamepadButton.MENU, model, imagePanel);
+ }
+ return backGuideComponent;
+ }
+}
diff --git a/src/main/java/se/lantz/gui/gamepad/USBControllerBackgroundPanel.java b/src/main/java/se/lantz/gui/gamepad/USBControllerBackgroundPanel.java
new file mode 100644
index 0000000..21eda73
--- /dev/null
+++ b/src/main/java/se/lantz/gui/gamepad/USBControllerBackgroundPanel.java
@@ -0,0 +1,66 @@
+package se.lantz.gui.gamepad;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+
+import javax.swing.JPanel;
+
+import se.lantz.model.JoystickModel;
+
+public class USBControllerBackgroundPanel extends JPanel
+{
+ private USBControllerInfoPanel gamePadInfoPanel;
+ private USBControllerImagePanel gamePadImagePanel;
+ private USBControllerMappingPanel gamePadMappingPanel;
+ private JoystickModel model;
+ public USBControllerBackgroundPanel(JoystickModel model) {
+ this.model = model;
+ GridBagLayout gridBagLayout = new GridBagLayout();
+ setLayout(gridBagLayout);
+ GridBagConstraints gbc_gamePadInfoPanel = new GridBagConstraints();
+ gbc_gamePadInfoPanel.gridwidth = 2;
+ gbc_gamePadInfoPanel.insets = new Insets(0, 0, 5, 0);
+ gbc_gamePadInfoPanel.anchor = GridBagConstraints.NORTHWEST;
+ gbc_gamePadInfoPanel.weightx = 1.0;
+ gbc_gamePadInfoPanel.fill = GridBagConstraints.BOTH;
+ gbc_gamePadInfoPanel.gridx = 0;
+ gbc_gamePadInfoPanel.gridy = 0;
+ add(getGamePadInfoPanel(), gbc_gamePadInfoPanel);
+ GridBagConstraints gbc_gamePadImagePanel = new GridBagConstraints();
+ gbc_gamePadImagePanel.anchor = GridBagConstraints.NORTHWEST;
+ gbc_gamePadImagePanel.insets = new Insets(0, 0, 5, 10);
+ gbc_gamePadImagePanel.weightx = 1.0;
+ gbc_gamePadImagePanel.fill = GridBagConstraints.BOTH;
+ gbc_gamePadImagePanel.gridx = 1;
+ gbc_gamePadImagePanel.gridy = 1;
+ add(getGamePadImagePanel(), gbc_gamePadImagePanel);
+ GridBagConstraints gbc_gamePadMappingPanel = new GridBagConstraints();
+ gbc_gamePadMappingPanel.insets = new Insets(0, 10, 0, 0);
+ gbc_gamePadMappingPanel.weighty = 1.0;
+ gbc_gamePadMappingPanel.weightx = 1.0;
+ gbc_gamePadMappingPanel.anchor = GridBagConstraints.NORTHWEST;
+ gbc_gamePadMappingPanel.fill = GridBagConstraints.BOTH;
+ gbc_gamePadMappingPanel.gridx = 0;
+ gbc_gamePadMappingPanel.gridy = 1;
+ add(getGamePadMappingPanel(), gbc_gamePadMappingPanel);
+ }
+ private USBControllerInfoPanel getGamePadInfoPanel() {
+ if (gamePadInfoPanel == null) {
+ gamePadInfoPanel = new USBControllerInfoPanel();
+ }
+ return gamePadInfoPanel;
+ }
+ private USBControllerImagePanel getGamePadImagePanel() {
+ if (gamePadImagePanel == null) {
+ gamePadImagePanel = new USBControllerImagePanel();
+ }
+ return gamePadImagePanel;
+ }
+ private USBControllerMappingPanel getGamePadMappingPanel() {
+ if (gamePadMappingPanel == null) {
+ gamePadMappingPanel = new USBControllerMappingPanel(model, getGamePadImagePanel());
+ }
+ return gamePadMappingPanel;
+ }
+}
diff --git a/src/main/java/se/lantz/gui/gamepad/GamePadImagePanel.java b/src/main/java/se/lantz/gui/gamepad/USBControllerImagePanel.java
similarity index 92%
rename from src/main/java/se/lantz/gui/gamepad/GamePadImagePanel.java
rename to src/main/java/se/lantz/gui/gamepad/USBControllerImagePanel.java
index a732bf6..0b31547 100644
--- a/src/main/java/se/lantz/gui/gamepad/GamePadImagePanel.java
+++ b/src/main/java/se/lantz/gui/gamepad/USBControllerImagePanel.java
@@ -17,9 +17,9 @@ import javax.swing.JPanel;
import se.lantz.util.FileManager;
-public class GamePadImagePanel extends JPanel
+public class USBControllerImagePanel extends JPanel
{
- public enum GamePadButton
+ public enum USBControllerButton
{
UP("Up", Character.toString(0x1f815)), DOWN("Down", Character.toString(0x1f817)),
LEFT("Left", Character.toString(0x1f814)), RIGHT("Right", Character.toString(0x1f816)), A("A", "A"), B("B", "B"),
@@ -30,7 +30,7 @@ public class GamePadImagePanel extends JPanel
public final String label;
public final String joyMapping;
- private GamePadButton(String label, String joyMapping)
+ private USBControllerButton(String label, String joyMapping)
{
this.label = label;
this.joyMapping = joyMapping;
@@ -40,9 +40,9 @@ public class GamePadImagePanel extends JPanel
ImageIcon gamepadImage = new ImageIcon(getClass().getResource("/se/lantz/logitech.png"));
private JLabel imageLabel;
- private GamePadButton currentButton = null;
+ private USBControllerButton currentButton = null;
- public GamePadImagePanel()
+ public USBControllerImagePanel()
{
GridBagLayout gridBagLayout = new GridBagLayout();
setLayout(gridBagLayout);
@@ -77,7 +77,7 @@ public class GamePadImagePanel extends JPanel
return imageLabel;
}
- public void setCurrentButtonAndRepaint(GamePadButton button)
+ public void setCurrentButtonAndRepaint(USBControllerButton button)
{
this.currentButton = button;
this.repaint();
diff --git a/src/main/java/se/lantz/gui/gamepad/GamePadInfoPanel.java b/src/main/java/se/lantz/gui/gamepad/USBControllerInfoPanel.java
similarity index 97%
rename from src/main/java/se/lantz/gui/gamepad/GamePadInfoPanel.java
rename to src/main/java/se/lantz/gui/gamepad/USBControllerInfoPanel.java
index 9cbef98..48ce4f4 100644
--- a/src/main/java/se/lantz/gui/gamepad/GamePadInfoPanel.java
+++ b/src/main/java/se/lantz/gui/gamepad/USBControllerInfoPanel.java
@@ -11,7 +11,7 @@ import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Color;
-public class GamePadInfoPanel extends JPanel
+public class USBControllerInfoPanel extends JPanel
{
ImageIcon compImage = new ImageIcon(getClass().getResource("/se/lantz/joystick-comp.png"));
@@ -19,7 +19,7 @@ public class GamePadInfoPanel extends JPanel
private JLabel compImageLabel;
private JLabel extraButtonsInfoLabel;
- public GamePadInfoPanel()
+ public USBControllerInfoPanel()
{
setBackground(Color.WHITE);
GridBagLayout gridBagLayout = new GridBagLayout();
diff --git a/src/main/java/se/lantz/gui/gamepad/MappingComponent.java b/src/main/java/se/lantz/gui/gamepad/USBControllerMappingComponent.java
similarity index 93%
rename from src/main/java/se/lantz/gui/gamepad/MappingComponent.java
rename to src/main/java/se/lantz/gui/gamepad/USBControllerMappingComponent.java
index 3d29c35..4412936 100644
--- a/src/main/java/se/lantz/gui/gamepad/MappingComponent.java
+++ b/src/main/java/se/lantz/gui/gamepad/USBControllerMappingComponent.java
@@ -16,19 +16,19 @@ import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import se.lantz.gui.KeySelectionComboBox;
-import se.lantz.gui.gamepad.GamePadImagePanel.GamePadButton;
+import se.lantz.gui.gamepad.USBControllerImagePanel.USBControllerButton;
import se.lantz.model.JoystickModel;
-public class MappingComponent extends JPanel
+public class USBControllerMappingComponent extends JPanel
{
private JLabel buttonTextLabel;
private KeySelectionComboBox keySelectionComboBox;
private JLabel joyMapLabel;
- private GamePadButton button;
+ private USBControllerButton button;
private JoystickModel model;
- private GamePadImagePanel imagePanel;
+ private USBControllerImagePanel imagePanel;
- public MappingComponent(GamePadButton button, JoystickModel model, GamePadImagePanel imagePanel)
+ public USBControllerMappingComponent(USBControllerButton button, JoystickModel model, USBControllerImagePanel imagePanel)
{
this.button = button;
this.model = model;
@@ -193,7 +193,7 @@ public class MappingComponent extends JPanel
Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (focusOwner instanceof KeySelectionComboBox)
{
- MappingComponent focusedMappingComponent = (MappingComponent)SwingUtilities.getAncestorOfClass(MappingComponent.class, focusOwner);
+ USBControllerMappingComponent focusedMappingComponent = (USBControllerMappingComponent)SwingUtilities.getAncestorOfClass(USBControllerMappingComponent.class, focusOwner);
if (focusedMappingComponent != null)
{
imagePanel.setCurrentButtonAndRepaint(focusedMappingComponent.button);
diff --git a/src/main/java/se/lantz/gui/gamepad/GamePadMappingPanel.java b/src/main/java/se/lantz/gui/gamepad/USBControllerMappingPanel.java
similarity index 60%
rename from src/main/java/se/lantz/gui/gamepad/GamePadMappingPanel.java
rename to src/main/java/se/lantz/gui/gamepad/USBControllerMappingPanel.java
index 489d610..234303a 100644
--- a/src/main/java/se/lantz/gui/gamepad/GamePadMappingPanel.java
+++ b/src/main/java/se/lantz/gui/gamepad/USBControllerMappingPanel.java
@@ -3,32 +3,32 @@ package se.lantz.gui.gamepad;
import java.awt.GridBagLayout;
import javax.swing.JPanel;
-import se.lantz.gui.gamepad.GamePadImagePanel.GamePadButton;
+import se.lantz.gui.gamepad.USBControllerImagePanel.USBControllerButton;
import se.lantz.model.JoystickModel;
import java.awt.GridBagConstraints;
import java.awt.Insets;
-public class GamePadMappingPanel extends JPanel
+public class USBControllerMappingPanel extends JPanel
{
- private MappingComponent upComponent;
+ private USBControllerMappingComponent upComponent;
private JoystickModel model;
- private MappingComponent downComponent;
- private MappingComponent leftComponent;
- private MappingComponent rightComponent;
- private MappingComponent xComponent;
- private MappingComponent yComponent;
- private MappingComponent aComponent;
- private MappingComponent bComponent;
- private MappingComponent leftTriggerComponent;
- private MappingComponent rightTriggerComponent;
- private MappingComponent backGuideComponent;
- private MappingComponent leftShoulderComponent;
- private MappingComponent rightShoulderComponent;
- private MappingComponent leftStickComponent;
- private MappingComponent rightStickComponent;
- private GamePadImagePanel imagePanel;
+ private USBControllerMappingComponent downComponent;
+ private USBControllerMappingComponent leftComponent;
+ private USBControllerMappingComponent rightComponent;
+ private USBControllerMappingComponent xComponent;
+ private USBControllerMappingComponent yComponent;
+ private USBControllerMappingComponent aComponent;
+ private USBControllerMappingComponent bComponent;
+ private USBControllerMappingComponent leftTriggerComponent;
+ private USBControllerMappingComponent rightTriggerComponent;
+ private USBControllerMappingComponent backGuideComponent;
+ private USBControllerMappingComponent leftShoulderComponent;
+ private USBControllerMappingComponent rightShoulderComponent;
+ private USBControllerMappingComponent leftStickComponent;
+ private USBControllerMappingComponent rightStickComponent;
+ private USBControllerImagePanel imagePanel;
- public GamePadMappingPanel(JoystickModel model, GamePadImagePanel imagePanel)
+ public USBControllerMappingPanel(JoystickModel model, USBControllerImagePanel imagePanel)
{
this.model = model;
this.imagePanel = imagePanel;
@@ -114,93 +114,93 @@ public class GamePadMappingPanel extends JPanel
gbc_rightStickComponent.gridy = 7;
add(getRightStickComponent(), gbc_rightStickComponent);
}
- private MappingComponent getUpComponent() {
+ private USBControllerMappingComponent getUpComponent() {
if (upComponent == null) {
- upComponent = new MappingComponent(GamePadButton.UP, model, imagePanel);
+ upComponent = new USBControllerMappingComponent(USBControllerButton.UP, model, imagePanel);
}
return upComponent;
}
- private MappingComponent getDowngComponent() {
+ private USBControllerMappingComponent getDowngComponent() {
if (downComponent == null) {
- downComponent = new MappingComponent(GamePadButton.DOWN, model, imagePanel);
+ downComponent = new USBControllerMappingComponent(USBControllerButton.DOWN, model, imagePanel);
}
return downComponent;
}
- private MappingComponent getMappingComponent_2() {
+ private USBControllerMappingComponent getMappingComponent_2() {
if (leftComponent == null) {
- leftComponent = new MappingComponent(GamePadButton.LEFT, model, imagePanel);
+ leftComponent = new USBControllerMappingComponent(USBControllerButton.LEFT, model, imagePanel);
}
return leftComponent;
}
- private MappingComponent getRightComponent() {
+ private USBControllerMappingComponent getRightComponent() {
if (rightComponent == null) {
- rightComponent = new MappingComponent(GamePadButton.RIGHT, model, imagePanel);
+ rightComponent = new USBControllerMappingComponent(USBControllerButton.RIGHT, model, imagePanel);
}
return rightComponent;
}
- private MappingComponent getXComponent() {
+ private USBControllerMappingComponent getXComponent() {
if (xComponent == null) {
- xComponent = new MappingComponent(GamePadButton.X, model, imagePanel);
+ xComponent = new USBControllerMappingComponent(USBControllerButton.X, model, imagePanel);
}
return xComponent;
}
- private MappingComponent getYComponent() {
+ private USBControllerMappingComponent getYComponent() {
if (yComponent == null) {
- yComponent = new MappingComponent(GamePadButton.Y, model, imagePanel);
+ yComponent = new USBControllerMappingComponent(USBControllerButton.Y, model, imagePanel);
}
return yComponent;
}
- private MappingComponent getAComponent() {
+ private USBControllerMappingComponent getAComponent() {
if (aComponent == null) {
- aComponent = new MappingComponent(GamePadButton.A, model, imagePanel);
+ aComponent = new USBControllerMappingComponent(USBControllerButton.A, model, imagePanel);
}
return aComponent;
}
- private MappingComponent getBComponent() {
+ private USBControllerMappingComponent getBComponent() {
if (bComponent == null) {
- bComponent = new MappingComponent(GamePadButton.B, model, imagePanel);
+ bComponent = new USBControllerMappingComponent(USBControllerButton.B, model, imagePanel);
}
return bComponent;
}
- private MappingComponent getLeftTriggerComponent() {
+ private USBControllerMappingComponent getLeftTriggerComponent() {
if (leftTriggerComponent == null) {
- leftTriggerComponent = new MappingComponent(GamePadButton.LEFT_TRIGGER, model, imagePanel);
+ leftTriggerComponent = new USBControllerMappingComponent(USBControllerButton.LEFT_TRIGGER, model, imagePanel);
}
return leftTriggerComponent;
}
- private MappingComponent getRightTriggerComponent() {
+ private USBControllerMappingComponent getRightTriggerComponent() {
if (rightTriggerComponent == null) {
- rightTriggerComponent = new MappingComponent(GamePadButton.RIGHT_TRIGGER, model, imagePanel);
+ rightTriggerComponent = new USBControllerMappingComponent(USBControllerButton.RIGHT_TRIGGER, model, imagePanel);
}
return rightTriggerComponent;
}
- private MappingComponent getBackGuideComponent() {
+ private USBControllerMappingComponent getBackGuideComponent() {
if (backGuideComponent == null) {
- backGuideComponent = new MappingComponent(GamePadButton.BACK_GUIDE, model, imagePanel);
+ backGuideComponent = new USBControllerMappingComponent(USBControllerButton.BACK_GUIDE, model, imagePanel);
}
return backGuideComponent;
}
- private MappingComponent getLeftShoulderComponent() {
+ private USBControllerMappingComponent getLeftShoulderComponent() {
if (leftShoulderComponent == null) {
- leftShoulderComponent = new MappingComponent(GamePadButton.LEFT_SHOULDER, model, imagePanel);
+ leftShoulderComponent = new USBControllerMappingComponent(USBControllerButton.LEFT_SHOULDER, model, imagePanel);
}
return leftShoulderComponent;
}
- private MappingComponent getRightShoulderComponent() {
+ private USBControllerMappingComponent getRightShoulderComponent() {
if (rightShoulderComponent == null) {
- rightShoulderComponent = new MappingComponent(GamePadButton.RIGHT_SHOULDER, model, imagePanel);
+ rightShoulderComponent = new USBControllerMappingComponent(USBControllerButton.RIGHT_SHOULDER, model, imagePanel);
}
return rightShoulderComponent;
}
- private MappingComponent getLeftStickComponent() {
+ private USBControllerMappingComponent getLeftStickComponent() {
if (leftStickComponent == null) {
- leftStickComponent = new MappingComponent(GamePadButton.LEFT_STICK, model, imagePanel);
+ leftStickComponent = new USBControllerMappingComponent(USBControllerButton.LEFT_STICK, model, imagePanel);
}
return leftStickComponent;
}
- private MappingComponent getRightStickComponent() {
+ private USBControllerMappingComponent getRightStickComponent() {
if (rightStickComponent == null) {
- rightStickComponent = new MappingComponent(GamePadButton.RIGHT_STICK, model, imagePanel);
+ rightStickComponent = new USBControllerMappingComponent(USBControllerButton.RIGHT_STICK, model, imagePanel);
}
return rightStickComponent;
}
diff --git a/src/main/resources/se/lantz/TheGamepad.png b/src/main/resources/se/lantz/TheGamepad.png
new file mode 100644
index 0000000000000000000000000000000000000000..f24bfb66871f2a84878451b5451b3b9ebbf5d8a2
GIT binary patch
literal 42961
zcmV*CKyAN?P)VFbYOJ!
znqOSMd-pEPC_4bVfT|V#8
zZueo?TvaCH!WxwGW2iSWxO;C$?iYW|{rMU9s)j18Dzb9O5Fx8+sUOzKEim2N;5RN|
zxL6cq?MB9M
rAy1p
z%O8H^;m~MMFExvTtiCCY(b3V~UcTXl?@`hu!ALL|i^pNCXo#6443(z^Fb4tFNoL#v
z8!DjH%?#+`$&M)@6tk&FK+*C60j*J?=~IE`W=$_8VWv+`Kp@ZIFyiq9c%fDrS{?|o
z-40ti7&l(Nrq`2;+iht$3N+0;)7=G7fY_DX1fnzB40xc^=J44JUzX?a^14iOIrdjp
z>n1jnaW<$BAOlO@BhF^i5&PnpvtpPpy~pgzNsa}C4Oa)kf$D>mVrgKv`E6OhVe>of
zb&+voGT-EQn#
zF{|iM!Y)7`bI-&2c}R;S8Gp1C(f=%EfW;RcQiUEx(AMEB{bC&xIOGow3VClVV5Z`k
z#>ML7tjzNqDTaBd7b2G>bg}|-66J-&@Mq+*PJ7M;-!QPGc6*%Ao!jTZZr
=Gj6~v
-p3Vo3Rk_qz#rI53O@>g&`eS2CTd}~o9fy9
z89yk9qm<*p=UG#cuTR#|0`IS57G9aZ8OQnF^sw^@X!LmRCdIQ&;RJ|H3H(d%FRj~)
z*1jLkxPyPLv~VWq(y+?diq(J|7lee+R?m@9KJa$YK_@1*N2Jr?QaZ{v`@5$eI}#Nk
znkW-J6m|R0^k4}{JadCpK#B{5=$?NE9C0R+#Vmd+aO#Jhz&x!1>^qQlFsi{k9rJ5e
zG}Y$IV#2j@*=s9Kb&BO$hixUHW1}`P73C0BPn5b~&(j1=O#w18sCKH<`=d0QxoH?B
z;^p1E{S46sMWMV4e0o+3lt(*;nUyL+H;TAGw6Zv92#MTDt3S=HZ9`BrP`
zB%-3kB8Pp{HxnnmyHn{J3)Ru3hyf$rlCPU5GOzXbW?