From 06de465945f665a1c2b46b24e9748b2d3d41807c Mon Sep 17 00:00:00 2001 From: Sandy Noble Date: Tue, 16 Apr 2013 23:14:46 +0100 Subject: [PATCH] Added downloading speed and lift range. Fixed some errors around vector rescaling. Added "upload speed" and "upload lift range" as buttons, but upload speed isn't showing up for some reason. Another day. Removed procontroll as a dependency and the gamepad as an input device. Commented out code in case anyone else wants it. --- controlsActions.pde | 55 ++-- controlsSetup.pde | 12 +- drawing.pde | 9 +- gamepad.pde | 429 +++++++++++++++++--------------- polargraphcontroller_webcam.pde | 171 +++++++------ 5 files changed, 377 insertions(+), 299 deletions(-) diff --git a/controlsActions.pde b/controlsActions.pde index 1bb91ea..5e580fb 100644 --- a/controlsActions.pde +++ b/controlsActions.pde @@ -104,6 +104,10 @@ void numberbox_mode_penDownPos(int value) penLiftDownPosition = value; } void button_mode_sendPenliftRange() +{ + addToCommandQueue(CMD_SETPENLIFTRANGE+penLiftDownPosition+","+penLiftUpPosition+",END"); +} +void button_mode_sendPenliftRangePersist() { addToCommandQueue(CMD_SETPENLIFTRANGE+penLiftDownPosition+","+penLiftUpPosition+",1,END"); } @@ -451,24 +455,27 @@ void numberbox_mode_resizeImage(float value) void numberbox_mode_resizeVector(float value) { - // get current size of vector in local coordinates - PVector oldVectorSize = new PVector(getVectorShape().width, getVectorShape().height); - oldVectorSize = PVector.mult(oldVectorSize, (vectorScaling/100)); - // and current centre point of vector - PVector oldCentroid = new PVector(oldVectorSize.x / 2.0, oldVectorSize.y / 2.0); - - // get newly scaled size of vector - PVector newVectorSize = new PVector(getVectorShape().width, getVectorShape().height); - newVectorSize = PVector.mult(newVectorSize, (value/100)); - // and new centre point of vector - PVector newCentroid = new PVector(newVectorSize.x / 2.0, newVectorSize.y / 2.0); - - // difference is current centre minus new centre - PVector difference = PVector.sub(oldCentroid, newCentroid); - - // add difference onto vector position - PVector newVectorPosition = PVector.add(vectorPosition, difference); - vectorPosition = newVectorPosition; + if (getVectorShape() != null) + { + // get current size of vector in local coordinates + PVector oldVectorSize = new PVector(getVectorShape().width, getVectorShape().height); + oldVectorSize = PVector.mult(oldVectorSize, (vectorScaling/100)); + // and current centre point of vector + PVector oldCentroid = new PVector(oldVectorSize.x / 2.0, oldVectorSize.y / 2.0); + + // get newly scaled size of vector + PVector newVectorSize = new PVector(getVectorShape().width, getVectorShape().height); + newVectorSize = PVector.mult(newVectorSize, (value/100)); + // and new centre point of vector + PVector newCentroid = new PVector(newVectorSize.x / 2.0, newVectorSize.y / 2.0); + + // difference is current centre minus new centre + PVector difference = PVector.sub(oldCentroid, newCentroid); + + // add difference onto vector position + PVector newVectorPosition = PVector.add(vectorPosition, difference); + vectorPosition = newVectorPosition; + } vectorScaling = value; @@ -610,6 +617,18 @@ void button_mode_sendMachineSpeed() addToRealtimeCommandQueue(CMD_SETMOTORACCEL+df.format(currentMachineAccel)+",END"); } +void button_mode_sendMachineSpeedPersist() +{ + NumberFormat nf = NumberFormat.getNumberInstance(Locale.UK); + DecimalFormat df = (DecimalFormat)nf; + + df.applyPattern("###.##"); + addToCommandQueue(CMD_SETMOTORSPEED+df.format(currentMachineMaxSpeed)+",1,END"); + + df.applyPattern("###.##"); + addToCommandQueue(CMD_SETMOTORACCEL+df.format(currentMachineAccel)+",1,END"); +} + void button_mode_sendRoveArea() { if (isBoxSpecified()) diff --git a/controlsSetup.pde b/controlsSetup.pde index ac4da4b..a5f1e86 100644 --- a/controlsSetup.pde +++ b/controlsSetup.pde @@ -301,7 +301,6 @@ Map initialiseNumberboxValues(Map map) } else if (MODE_CHANGE_MACHINE_WIDTH.equals(key)) { - println("key:"+key+", width: " + getDisplayMachine().getWidth() + ", multiplied:"+getDisplayMachine().inMM(getDisplayMachine().getWidth())); n.setValue(getDisplayMachine().inMM(getDisplayMachine().getWidth())); n.setMin(20); n.setMultiplier(0.5); @@ -752,10 +751,12 @@ List getControlNamesForDetailPanel() controlNames.add(MODE_PEN_LIFT_POS_UP); controlNames.add(MODE_PEN_LIFT_POS_DOWN); controlNames.add(MODE_SEND_PEN_LIFT_RANGE); + controlNames.add(MODE_SEND_PEN_LIFT_RANGE_PERSIST); controlNames.add(MODE_CHANGE_MACHINE_MAX_SPEED); controlNames.add(MODE_CHANGE_MACHINE_ACCELERATION); controlNames.add(MODE_SEND_MACHINE_SPEED); + controlNames.add(MODE_SEND_MACHINE_SPEED_PERSIST); controlNames.add(MODE_CHANGE_SERIAL_PORT); @@ -813,8 +814,6 @@ Map buildControlLabels() result.put(MODE_DRAW_TESTPATTERN, "test pattern"); result.put(MODE_PLACE_IMAGE, "place image"); result.put(MODE_LOAD_IMAGE, "Load image file"); - result.put(MODE_INC_ROW_SIZE, "Rowsize up"); - result.put(MODE_DEC_ROW_SIZE, "Rowsize down"); result.put(MODE_SET_POSITION_HOME, "Set home"); result.put(MODE_RETURN_TO_HOME, "Return to home"); result.put(MODE_INPUT_SINGLE_PIXEL, "Choose pixel"); @@ -877,6 +876,7 @@ Map buildControlLabels() result.put(MODE_CHANGE_MACHINE_MAX_SPEED, "Motor max speed"); result.put(MODE_CHANGE_MACHINE_ACCELERATION, "Motor acceleration"); result.put(MODE_SEND_MACHINE_SPEED, "Send speed"); + result.put(MODE_SEND_MACHINE_SPEED_PERSIST, "Upload speed"); result.put(MODE_RENDER_VECTORS, "Draw vectors"); result.put(MODE_LOAD_VECTOR_FILE, "Load vector"); result.put(MODE_CHANGE_MIN_VECTOR_LINE_LENGTH, "Shortest vector"); @@ -900,7 +900,8 @@ Map buildControlLabels() result.put(MODE_PEN_LIFT_DOWN, "Pen drop"); result.put(MODE_PEN_LIFT_POS_UP, "Pen up position"); result.put(MODE_PEN_LIFT_POS_DOWN, "Pen down position"); - result.put(MODE_SEND_PEN_LIFT_RANGE, "Send lift range"); + result.put(MODE_SEND_PEN_LIFT_RANGE, "Test lift range"); + result.put(MODE_SEND_PEN_LIFT_RANGE_PERSIST, "Upload lift range"); result.put(MODE_SEND_ROVE_AREA, "Send Roving Area"); result.put(MODE_SEND_START_TEXT, "Start text at point"); @@ -952,8 +953,6 @@ Set buildControlNames() result.add(MODE_DRAW_TESTPATTERN); result.add(MODE_PLACE_IMAGE); result.add(MODE_LOAD_IMAGE); - result.add(MODE_INC_ROW_SIZE); - result.add(MODE_DEC_ROW_SIZE); result.add(MODE_SET_POSITION_HOME); result.add(MODE_RETURN_TO_HOME); result.add(MODE_INPUT_SINGLE_PIXEL); @@ -1037,6 +1036,7 @@ Set buildControlNames() result.add(MODE_PEN_LIFT_POS_UP); result.add(MODE_PEN_LIFT_POS_DOWN); result.add(MODE_SEND_PEN_LIFT_RANGE); + result.add(MODE_SEND_PEN_LIFT_RANGE_PERSIST); result.add(MODE_SEND_ROVE_AREA); result.add(MODE_SEND_START_TEXT); diff --git a/drawing.pde b/drawing.pde index fc188d9..01bc463 100644 --- a/drawing.pde +++ b/drawing.pde @@ -120,8 +120,15 @@ void sendMachineSpec() addToCommandQueue(command); command = CMD_SETMACHINESTEPMULTIPLIER+machineStepMultiplier+",END"; addToCommandQueue(command); - command = CMD_SETPENLIFTRANGE+penLiftDownPosition+","+penLiftUpPosition+",END"; + command = CMD_SETPENLIFTRANGE+penLiftDownPosition+","+penLiftUpPosition+",1,END"; addToCommandQueue(command); + + // speeds + NumberFormat nf = NumberFormat.getNumberInstance(Locale.UK); + DecimalFormat df = (DecimalFormat)nf; + df.applyPattern("###.##"); + addToCommandQueue(CMD_SETMOTORSPEED+df.format(currentMachineMaxSpeed)+",1,END"); + addToCommandQueue(CMD_SETMOTORACCEL+df.format(currentMachineAccel)+",1,END"); } public PVector getMouseVector() diff --git a/gamepad.pde b/gamepad.pde index 5ccce46..c288673 100644 --- a/gamepad.pde +++ b/gamepad.pde @@ -1,197 +1,234 @@ -ControllIO controllIO; -ControllDevice joypad; +//ControllIO controllIO; +//ControllDevice joypad; +// +//ControllButton buttonA; +//ControllButton buttonB; +//ControllButton buttonX; +//ControllButton buttonY; +//ControllButton buttonL; +//ControllButton buttonR; +//ControllButton buttonStart; +// +//ControllCoolieHat dpad; +// +//List devices = new ArrayList( +// Arrays.asList("Controller (Xbox 360 Wireless Receiver for Windows)", +// "Controller (XBOX 360 For Windows)")); +// +//String signalFromGamepad = null; +// +//static final String BUTTON_A_RELEASED = "ButtonAReleased"; +//static final String BUTTON_B_RELEASED = "ButtonBReleased"; +//static final String BUTTON_L_RELEASED = "ButtonLReleased"; +//static final String BUTTON_R_RELEASED = "ButtonRReleased"; +//static final String BUTTON_START_RELEASED = "ButtonStartReleased"; +// +//void gamepad_init() +//{ +// controllIO = ControllIO.getInstance(this); +// +// try +// { +// controllIO.printDevices(); +// for (int i = 0; i LIVE_SIMPLIFICATION_MAX) +// liveSimplification = LIVE_SIMPLIFICATION_MAX; +// } +// if (val == 8.0) // left +// { +// pathLengthHighPassCutoff--; +// if (pathLengthHighPassCutoff < PATH_LENGTH_HIGHPASS_CUTOFF_MIN) +// pathLengthHighPassCutoff = PATH_LENGTH_HIGHPASS_CUTOFF_MIN; +// } +// else if (val == 4.0) // right +// { +// pathLengthHighPassCutoff++; +// if (pathLengthHighPassCutoff > PATH_LENGTH_HIGHPASS_CUTOFF_MAX) +// pathLengthHighPassCutoff = PATH_LENGTH_HIGHPASS_CUTOFF_MAX; +// } +// +// Numberbox n = (Numberbox) getAllControls().get(MODE_LIVE_SIMPLIFICATION_VALUE); +// n.setValue(liveSimplification); +// n.update(); +// +// n = (Numberbox) getAllControls().get(MODE_VECTOR_PATH_LENGTH_HIGHPASS_CUTOFF); +// n.setValue(pathLengthHighPassCutoff); +// n.update(); +// +//} +// +//void processGamepadInput() +//{ +// if (signalFromGamepad != null) +// { +// println("Signal from gamepad: " + signalFromGamepad); +// if (signalFromGamepad == BUTTON_A_RELEASED) +// { +// if (captureShape == null && !confirmedDraw) +// button_mode_liveCaptureFromLive(); +// else if (captureShape != null && !confirmedDraw) +// button_mode_liveClearCapture(); +// else if (captureShape != null && confirmedDraw) +// { +// button_mode_liveClearCapture(); +// button_mode_clearQueue(); +// confirmedDraw = false; +// } +// } +// else if (signalFromGamepad == BUTTON_B_RELEASED) +// { +// if (captureShape != null && !confirmedDraw) +// button_mode_liveConfirmDraw(); +// } +// else if (signalFromGamepad == BUTTON_L_RELEASED) +// { +// commandQueueRunning = !commandQueueRunning; +// } +// else if (signalFromGamepad == BUTTON_R_RELEASED) +// { +// } +// else if (signalFromGamepad == BUTTON_START_RELEASED) +// { +// preLoadCommandQueue(); +// button_mode_setPositionHome(); +// } +// +// +// // clear the signal +// signalFromGamepad = null; +// } +// +//} -ControllButton buttonA; -ControllButton buttonB; -ControllButton buttonX; -ControllButton buttonY; -ControllButton buttonL; -ControllButton buttonR; -ControllButton buttonStart; - -ControllCoolieHat dpad; - -List devices = new ArrayList( - Arrays.asList("Controller (Xbox 360 Wireless Receiver for Windows)", - "Controller (XBOX 360 For Windows)")); - -String signalFromGamepad = null; - -static final String BUTTON_A_RELEASED = "ButtonAReleased"; -static final String BUTTON_B_RELEASED = "ButtonBReleased"; -static final String BUTTON_L_RELEASED = "ButtonLReleased"; -static final String BUTTON_R_RELEASED = "ButtonRReleased"; -static final String BUTTON_START_RELEASED = "ButtonStartReleased"; - -void gamepad_init() -{ - controllIO = ControllIO.getInstance(this); - - try - { - controllIO.printDevices(); - for (int i = 0; i LIVE_SIMPLIFICATION_MAX) - liveSimplification = LIVE_SIMPLIFICATION_MAX; - } - if (val == 8.0) // left - { - pathLengthHighPassCutoff--; - if (pathLengthHighPassCutoff < PATH_LENGTH_HIGHPASS_CUTOFF_MIN) - pathLengthHighPassCutoff = PATH_LENGTH_HIGHPASS_CUTOFF_MIN; - } - else if (val == 4.0) // right - { - pathLengthHighPassCutoff++; - if (pathLengthHighPassCutoff > PATH_LENGTH_HIGHPASS_CUTOFF_MAX) - pathLengthHighPassCutoff = PATH_LENGTH_HIGHPASS_CUTOFF_MAX; - } - - Numberbox n = (Numberbox) getAllControls().get(MODE_LIVE_SIMPLIFICATION_VALUE); - n.setValue(liveSimplification); - n.update(); - - n = (Numberbox) getAllControls().get(MODE_VECTOR_PATH_LENGTH_HIGHPASS_CUTOFF); - n.setValue(pathLengthHighPassCutoff); - n.update(); - -} - -void processGamepadInput() -{ - if (signalFromGamepad != null) - { - println("Signal from gamepad: " + signalFromGamepad); - if (signalFromGamepad == BUTTON_A_RELEASED) - { - if (captureShape == null && !confirmedDraw) - button_mode_liveCaptureFromLive(); - else if (captureShape != null && !confirmedDraw) - button_mode_liveClearCapture(); - else if (captureShape != null && confirmedDraw) - { - button_mode_liveClearCapture(); - button_mode_clearQueue(); - confirmedDraw = false; - } - } - else if (signalFromGamepad == BUTTON_B_RELEASED) - { - if (captureShape != null && !confirmedDraw) - button_mode_liveConfirmDraw(); - } - else if (signalFromGamepad == BUTTON_L_RELEASED) - { - commandQueueRunning = !commandQueueRunning; - } - else if (signalFromGamepad == BUTTON_R_RELEASED) - { - } - else if (signalFromGamepad == BUTTON_START_RELEASED) - { - preLoadCommandQueue(); - button_mode_setPositionHome(); - } - - - // clear the signal - signalFromGamepad = null; - } - -} +//void displayGamepadOverlay() +//{ +// textSize(40); +// fill(255); +// +// if (captureShape == null) +// { +// image(aButtonImage, width-400, height-180, 128, 128); +// text("SNAP!", width-400, height-200); +// +// textSize(30); +// image(dpadYImage, width-600, height-180, 128, 128); +// text("Simplify", width-600, height-200); +// +// image(dpadXImage, width-600, height-400, 128, 128); +// text("Filter short paths", width-600, height-420); +// } +// else +// { +// if (confirmedDraw) +// { +// image(aButtonImage, width-400, height-180, 128, 128); +// text("CANCEL!", width-385, height-200); +// } +// else +// { +// image(aButtonImage, width-400, height-180, 128, 128); +// text("BACK", width-400, height-200); +// image(bButtonImage, width-190, height-180, 128, 128); +// text("DRAW!", width-180, height-200); +// } +// } +// +// +// textSize(12); +//} diff --git a/polargraphcontroller_webcam.pde b/polargraphcontroller_webcam.pde index 3153a41..fa83ca3 100644 --- a/polargraphcontroller_webcam.pde +++ b/polargraphcontroller_webcam.pde @@ -8,8 +8,6 @@ import org.apache.batik.svggen.font.table.*; import org.apache.batik.svggen.font.*; import java.util.zip.CRC32; -import procontroll.*; -//import net.java.games.input.*; // for OSX import java.text.*; @@ -198,8 +196,6 @@ static final String MODE_RENDER_PIXEL_DIALOG = "button_mode_drawPixelsDialog"; static final String MODE_INPUT_ROW_START = "button_mode_inputRowStart"; static final String MODE_INPUT_ROW_END = "button_mode_inputRowEnd"; static final String MODE_DRAW_TESTPATTERN = "button_mode_drawTestPattern"; -static final String MODE_INC_ROW_SIZE = "button_mode_incRowSize"; -static final String MODE_DEC_ROW_SIZE = "button_mode_decRowSize"; static final String MODE_DRAW_GRID = "button_mode_drawGrid"; static final String MODE_PLACE_IMAGE = "button_mode_placeImage"; static final String MODE_LOAD_IMAGE = "button_mode_loadImage"; @@ -276,6 +272,7 @@ static final String MODE_CHANGE_PEN_TEST_INCREMENT_SIZE = "numberbox_mode_change static final String MODE_CHANGE_MACHINE_MAX_SPEED = "numberbox_mode_changeMachineMaxSpeed"; static final String MODE_CHANGE_MACHINE_ACCELERATION = "numberbox_mode_changeMachineAcceleration"; static final String MODE_SEND_MACHINE_SPEED = "button_mode_sendMachineSpeed"; +static final String MODE_SEND_MACHINE_SPEED_PERSIST = "button_mode_sendMachineSpeedPersist"; static final String MODE_RENDER_VECTORS = "button_mode_renderVectors"; static final String MODE_LOAD_VECTOR_FILE = "button_mode_loadVectorFile"; @@ -296,6 +293,7 @@ static final String MODE_PEN_LIFT_DOWN = "button_mode_penDown"; static final String MODE_PEN_LIFT_POS_UP = "numberbox_mode_penUpPos"; static final String MODE_PEN_LIFT_POS_DOWN = "numberbox_mode_penDownPos"; static final String MODE_SEND_PEN_LIFT_RANGE = "button_mode_sendPenliftRange"; +static final String MODE_SEND_PEN_LIFT_RANGE_PERSIST = "button_mode_sendPenliftRangePersist"; static final String MODE_SEND_ROVE_AREA = "button_mode_sendRoveArea"; static final String MODE_SEND_START_TEXT = "toggle_mode_sendStartText"; @@ -458,6 +456,7 @@ boolean overwriteExistingStoreFile = true; public static Console console; public boolean useWindowedConsole = false; +static boolean webcamEnabled = false; static boolean drawingLiveVideo = false; static boolean drawingWebcamShape = true; static boolean flipWebcamImage = true; @@ -491,14 +490,14 @@ String shapeSavePath = "../../savedcaptures/"; String shapeSavePrefix = "shape-"; String shapeSaveExtension = ".svg"; -boolean displayGamepadOverlay = true; -PImage yButtonImage = null; -PImage xButtonImage = null; -PImage aButtonImage = null; -PImage bButtonImage = null; - -PImage dpadXImage = null; -PImage dpadYImage = null; +//boolean displayGamepadOverlay = false; +//PImage yButtonImage = null; +//PImage xButtonImage = null; +//PImage aButtonImage = null; +//PImage bButtonImage = null; +// +//PImage dpadXImage = null; +//PImage dpadYImage = null; void setup() { @@ -571,11 +570,20 @@ void setup() addEventListeners(); - gamepad_init(); - String[] cameras = Capture.list(); - if (cameras.length > 0) { - liveCamera = new Capture(this, 640, 480, cameras[0]); - //liveCamera.start(); + //gamepad_init(); + try + { + String[] cameras = Capture.list(); + if (cameras.length > 0) { + liveCamera = new Capture(this, 640, 480, cameras[0]); + //liveCamera.start(); + webcamEnabled = true; + } + } + catch (Exception e) + { + println("Exception occurred trying to look for attached webcams. Webcam will not be used. " + e.getMessage()); + webcamEnabled = false; } blob_detector = new BlobDetector( 640, 480); @@ -835,12 +843,19 @@ void drawWebcamPage() strokeWeight(3); stroke(150); noFill(); - getDisplayMachine().drawForWebcam(); - stroke(255, 0, 0); - - for (Panel panel : getPanelsForTab(TAB_NAME_WEBCAM)) + if (webcamEnabled) { - panel.draw(); + getDisplayMachine().drawForWebcam(); + stroke(255, 0, 0); + + for (Panel panel : getPanelsForTab(TAB_NAME_WEBCAM)) + { + panel.draw(); + } + } + else + { + text("No camera attached.", 250, 100); } if (displayingInfoTextOnInputPage) @@ -848,10 +863,10 @@ void drawWebcamPage() drawStatusText((int)statusTextPosition.x, (int)statusTextPosition.y); showCommandQueue((int) width-200, 20); - processGamepadInput(); - - if (displayGamepadOverlay) - displayGamepadOverlay(); +// processGamepadInput(); +// +// if (displayGamepadOverlay) +// displayGamepadOverlay(); } @@ -887,42 +902,7 @@ void drawImageLoadPage() drawImagePage(); } -void displayGamepadOverlay() -{ - textSize(40); - fill(255); - - if (captureShape == null) - { - image(aButtonImage, width-400, height-180, 128, 128); - text("SNAP!", width-400, height-200); - textSize(30); - image(dpadYImage, width-600, height-180, 128, 128); - text("Simplify", width-600, height-200); - - image(dpadXImage, width-600, height-400, 128, 128); - text("Filter short paths", width-600, height-420); - } - else - { - if (confirmedDraw) - { - image(aButtonImage, width-400, height-180, 128, 128); - text("CANCEL!", width-385, height-200); - } - else - { - image(aButtonImage, width-400, height-180, 128, 128); - text("BACK", width-400, height-200); - image(bButtonImage, width-190, height-180, 128, 128); - text("DRAW!", width-180, height-200); - } - } - - - textSize(12); -} void drawMoveImageOutline() { @@ -2455,6 +2435,11 @@ void serialEvent(Serial myPort) readStepsPerRev(incoming); else if (incoming.startsWith("PGSTEPMULTIPLIER")) readStepMultiplier(incoming); + else if (incoming.startsWith("PGLIFT")) + readPenLiftRange(incoming); + else if (incoming.startsWith("PGSPEED")) + readMachineSpeed(incoming); + else if ("RESEND".equals(incoming)) resendLastCommand(); else if ("DRAWING".equals(incoming)) @@ -2574,6 +2559,36 @@ void readMachineName(String sync) } } +void readMachineSpeed(String in) +{ + String[] splitted = split(in, ","); + if (splitted.length == 4) + { + String speed = splitted[1]; + String accel = splitted[2]; + + currentMachineMaxSpeed = Float.parseFloat(speed); + currentMachineAccel = Float.parseFloat(accel); + + updateNumberboxValues(); + } +} + +void readPenLiftRange(String in) +{ + String[] splitted = split(in, ","); + if (splitted.length == 4) + { + String downPos = splitted[1]; + String upPos = splitted[2]; + + penLiftDownPosition = Integer.parseInt(downPos); + penLiftUpPosition = Integer.parseInt(upPos); + + updateNumberboxValues(); + } +} + void resendLastCommand() { println("Re-sending command: " + lastCommand); @@ -3026,24 +3041,24 @@ void initLogging() } void initImages() { - try - { - yButtonImage = loadImage("y.png"); - xButtonImage = loadImage("x.png"); - aButtonImage = loadImage("a.png"); - bButtonImage = loadImage("b.png"); - dpadXImage = loadImage("dpadlr.png"); - dpadYImage = loadImage("dpadud.png"); - } - catch (Exception e) - { - yButtonImage = makeColourImage(64,64,color(180,180,0)); - xButtonImage = makeColourImage(64,64,color(0,0,180)); - aButtonImage = makeColourImage(64,64,color(0,180,0)); - bButtonImage = makeColourImage(64,64,color(180,0,0)); - } - +// try +// { +// yButtonImage = loadImage("y.png"); +// xButtonImage = loadImage("x.png"); +// aButtonImage = loadImage("a.png"); +// bButtonImage = loadImage("b.png"); +// dpadXImage = loadImage("dpadlr.png"); +// dpadYImage = loadImage("dpadud.png"); +// } +// catch (Exception e) +// { +// yButtonImage = makeColourImage(64,64,color(180,180,0)); +// xButtonImage = makeColourImage(64,64,color(0,0,180)); +// aButtonImage = makeColourImage(64,64,color(0,180,0)); +// bButtonImage = makeColourImage(64,64,color(180,0,0)); +// } } + PImage makeColourImage(int w, int h, int colour) { PImage img = createImage(w,h,RGB);