diff --git a/controlsActions.pde b/controlsActions.pde index 2e80d8f..6172c29 100644 --- a/controlsActions.pde +++ b/controlsActions.pde @@ -123,7 +123,15 @@ void numberbox_mode_livePosteriseValue(int value) void button_mode_liveCaptureFromLive() { webcam_captureCurrentImage(); -} +} +void button_mode_liveClearCapture() +{ + captureShape = null; +} +void button_mode_liveAddCaption() +{ + +} void button_mode_liveConfirmDraw() { @@ -131,13 +139,6 @@ void button_mode_liveConfirmDraw() float scaling = getDisplayMachine().inMM(getDisplayMachine().getPictureFrame().getWidth()) / captureShape.getWidth(); PVector position = new PVector(getDisplayMachine().inMM(getDisplayMachine().getPictureFrame().getPosition().x), getDisplayMachine().inMM(getDisplayMachine().getPictureFrame().getPosition().y) + (captureShape.getHeight() * scaling)); -// float scaling = getDisplayMachine().getPictureFrame().getWidth() / captureShape.getWidth(); -// println("Scaling: " + scaling); -// -// PVector position = getDisplayMachine().getPictureFrame().getPosition(); -// -// println("CApture shape: " + captureShape); - sendVectorShapes(captureShape, scaling, position); } diff --git a/controlsSetup.pde b/controlsSetup.pde index cde9b14..90ebc57 100644 --- a/controlsSetup.pde +++ b/controlsSetup.pde @@ -703,6 +703,8 @@ List getControlNamesForWebcamPanel() controlNames.add(MODE_LIVE_SIMPLIFICATION_VALUE); controlNames.add(MODE_LIVE_POSTERISE_VALUE); controlNames.add(MODE_LIVE_CAPTURE_FROM_LIVE); + controlNames.add(MODE_LIVE_CANCEL_CAPTURE); + controlNames.add(MODE_LIVE_ADD_CAPTION); controlNames.add(MODE_LIVE_CONFIRM_DRAW); return controlNames; } @@ -906,6 +908,8 @@ Map buildControlLabels() result.put(MODE_LIVE_POSTERISE_VALUE, "Posterise"); result.put(MODE_LIVE_CAPTURE_FROM_LIVE, "Capture"); result.put(MODE_LIVE_CONFIRM_DRAW, "Draw capture"); + result.put(MODE_LIVE_CANCEL_CAPTURE, "Cancel capture"); + result.put(MODE_LIVE_ADD_CAPTION, "Add caption"); return result; @@ -1037,6 +1041,8 @@ Set buildControlNames() result.add(MODE_LIVE_POSTERISE_VALUE); result.add(MODE_LIVE_CAPTURE_FROM_LIVE); result.add(MODE_LIVE_CONFIRM_DRAW); + result.add(MODE_LIVE_CANCEL_CAPTURE); + result.add(MODE_LIVE_ADD_CAPTION); return result; } diff --git a/gamepad.pde b/gamepad.pde new file mode 100644 index 0000000..abdc193 --- /dev/null +++ b/gamepad.pde @@ -0,0 +1,31 @@ +ControllIO controllIO; +ControllDevice joypad; +ControllCoolieHat cooliehat; +ControllStick leftStick; +ControllStick rightStick; + +ControllButton buttonA; +ControllButton buttonB; +ControllButton buttonX; +ControllButton buttonY; + +void gamepad_init() +{ + controllIO = ControllIO.getInstance(this); + + joypad = controllIO.getDevice("Controller (Xbox 360 Wireless Receiver for Windows)"); + joypad.printButtons(); + + buttonA = joypad.getButton("Button 0"); + buttonB = joypad.getButton("Button 1"); + buttonX = joypad.getButton("Button 2"); + buttonY = joypad.getButton("Button 3"); + + buttonA.plug(this, "buttonARelease", ControllIO.ON_RELEASE); +} + +void buttonARelease() +{ + button_mode_liveCaptureFromLive(); + +} diff --git a/polargraphcontroller_webcam.pde b/polargraphcontroller_webcam.pde index 2453710..a7d8a67 100644 --- a/polargraphcontroller_webcam.pde +++ b/polargraphcontroller_webcam.pde @@ -8,6 +8,9 @@ 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.*; import java.util.*; @@ -310,6 +313,8 @@ static final String MODE_LIVE_BLUR_VALUE = "numberbox_mode_liveBlurValue"; static final String MODE_LIVE_SIMPLIFICATION_VALUE = "numberbox_mode_liveSimplificationValue"; static final String MODE_LIVE_POSTERISE_VALUE = "numberbox_mode_livePosteriseValue"; static final String MODE_LIVE_CAPTURE_FROM_LIVE = "button_mode_liveCaptureFromLive"; +static final String MODE_LIVE_CANCEL_CAPTURE = "button_mode_liveClearCapture"; +static final String MODE_LIVE_ADD_CAPTION = "button_mode_liveAddCaption"; static final String MODE_LIVE_CONFIRM_DRAW = "button_mode_liveConfirmDraw"; @@ -451,6 +456,7 @@ public boolean useWindowedConsole = false; static boolean drawingLiveVideo = false; static boolean drawingWebcamShape = true; +static boolean flipWebcamImage = true; static PImage liveImage = null; static PImage processedLiveImage = null; @@ -537,6 +543,7 @@ void setup() addEventListeners(); + gamepad_init(); liveCamera = new JMyron(); liveCamera.start(640,480); @@ -809,7 +816,7 @@ void drawWebcamPage() if (displayingInfoTextOnInputPage) showText(250,45); drawStatusText((int)statusTextPosition.x, (int)statusTextPosition.y); - showCommandQueue((int) getDisplayMachine().getOutline().getRight()+6, 20); + showCommandQueue((int) width-200, 20); } diff --git a/webcam.pde b/webcam.pde index ba10a32..81333c5 100644 --- a/webcam.pde +++ b/webcam.pde @@ -4,6 +4,33 @@ public PImage webcam_buildLiveImage() PImage pimg = createImage(640,480, RGB); pimg.loadPixels(); pimg.pixels = liveCamera.image(); + // flip the image left to right + if (flipWebcamImage) + { + + List list = new ArrayList(480); + + for (int r=0; r