}
/**
* House Display Display
*/
Displayer houseDisplay = new Displayer();
houseDisplay.startPaintLoop();
JFrame house = new JFrame("Haunted House 2011: House");
house.getContentPane().add(houseDisplay);
house.setVisible(true);
house.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
/**
* Switch Display
*/
Displayer switchDisplay = new Displayer();
switchDisplay.startPaintLoop();
JFrame switchboard = new JFrame("Haunted House 2011: Switchboardv1");
switchboard.getContentPane().add(switchDisplay);
switchboard.setVisible(true);
switchboard.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
/**
* Master button: started and initialized
*/
MountedPosition masterButtonPos = new MountedPosition(RootMount.get(),
BUTTON_POSITIONS[MASTER_BUTTON][X],
BUTTON_POSITIONS[MASTER_BUTTON][Y], 0);
RPCSwitch masterRPC = new RPCSwitch(usbConn,
BUTTON_RPC_KEYS[MASTER_BUTTON]);
SwitchDisplay masterButtonDisplay = new SwitchDisplay(masterRPC,
masterButtonPos, MECHANISM_NAMES[MASTER_BUTTON]);
masterRPC.startListening();
masterButtonDisplay.startListening();
switchDisplay.addDisplayable(masterButtonDisplay);
/**
* Auto Button: started and initialized
*/
MountedPosition autoButtonPos = new MountedPosition(RootMount.get(),
BUTTON_POSITIONS[AUTO_BUTTON][X],
BUTTON_POSITIONS[AUTO_BUTTON][Y], 0);
RPCSwitch autoRPC = new RPCSwitch(usbConn, BUTTON_RPC_KEYS[AUTO_BUTTON]);
SwitchDisplay autoButtonDisplay = new SwitchDisplay(autoRPC,
autoButtonPos, MECHANISM_NAMES[AUTO_BUTTON]);
autoRPC.startListening();
autoButtonDisplay.startListening();
switchDisplay.addDisplayable(autoButtonDisplay);
/**
* RPC SWITCHES
*/
RPCSwitch[] rpcSwitches = new RPCSwitch[NUM_MECHS];
for (int i = 0; i < NUM_MECHS; i++) {
rpcSwitches[i] = new RPCSwitch(usbConn, BUTTON_RPC_KEYS[i]);
rpcSwitches[i].startListening();
}
/**
* Mechanism buttons : started and initialized
*/
MountedPosition[] buttonPositions = new MountedPosition[NUM_MECHS];
SwitchDisplay[] buttonDisplays = new SwitchDisplay[NUM_MECHS];
for (int i = 0; i < buttonPositions.length; i++) {
// TODO match real positions
// TODO labels
buttonPositions[i] = new MountedPosition(RootMount.get(),
BUTTON_POSITIONS[i][X], BUTTON_POSITIONS[i][Y], 0);
// rpcSwitches[i];
buttonDisplays[i] = new SwitchDisplay(rpcSwitches[i],
buttonPositions[i], MECHANISM_NAMES[i]);
buttonDisplays[i].startListening();
switchDisplay.addDisplayable(buttonDisplays[i]);
}
/**
* RPC SOLENOIDS
*/