Added option for PC/RASP

This commit is contained in:
2015-05-21 21:21:23 +02:00
parent f7175aa70a
commit 36cbc2b012
3 changed files with 23 additions and 5 deletions
+6 -2
View File
@@ -2,6 +2,7 @@ package control.button;
import java.awt.Color;
import main.Window;
import control.LedHandler;
public class Button {
@@ -22,8 +23,11 @@ public class Button {
private void setLed()
{
led.setLed(ledID, color.getGreen(), color.getRed(), color.getBlue());
led.show();
if(Window.ON_RASP)
{
led.setLed(ledID, color.getGreen(), color.getRed(), color.getBlue());
led.show();
}
}
public void setColor(Color newColor)
+5
View File
@@ -5,6 +5,7 @@ import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.List;
import main.Window;
import control.LedHandler;
public class ButtonHandler implements KeyListener{
@@ -71,6 +72,10 @@ public class ButtonHandler implements KeyListener{
case KeyEvent.VK_6:
buttonPress(buttons.get(6));
break;
case KeyEvent.VK_ESCAPE:
if(!Window.ON_RASP)
System.exit(0);
break;
}
}
+12 -3
View File
@@ -13,6 +13,9 @@ import control.button.ButtonHandler;
import control.joystick.JoystickHandler;
public class Window extends JFrame {
public static boolean ON_RASP = false;
public Window()
{
//Create window
@@ -32,9 +35,15 @@ public class Window extends JFrame {
setUndecorated(true);
//Create Events
LedHandler led = new LedHandler();
LedHandler led = null;
if(Window.ON_RASP) //TODO REMOVE
{
led = new LedHandler();
}
ButtonHandler bth = new ButtonHandler(led);
JoystickHandler jsh = new JoystickHandler(led);
JoystickHandler jsh = new JoystickHandler();
//Create Instances
GameView view = new GameView(led);
@@ -46,7 +55,7 @@ public class Window extends JFrame {
addKeyListener(bth);
addKeyListener(jsh);
bth.addButtonListener(control);
jsh.addJoyStickListener(control);
jsh.addJoystickListener(control);
//Display
pack();