Multi display Issue

edited November 2015 in Library Questions

Hi, I have this code but I need my video to display as a second window rather than over my map images. The video will be viewed on projectors and the map will be on a iMac Any help would be greatly appreciated.

I tried combining my code above with the second code on this page but could seem to get it to display.

Answers

  • edited November 2015

    Used G4P and got it to work better but still wondering how to get the background to come back after the videos are played and how to disable choosing a different video while one is in progress.

    import processing.video.*; import g4p_controls.*;

    GWindow[]window; GButton btnStart; GImageButton btnRou1, btnRou2, btnRou3, btnRou4, btnRou5; GLabel lblOut; long timer; public PImage bg, bg2; public Movie movie, movie2, movie3, movie4; public boolean isPlaying;

    /////////////// IMAGE BACKGROUND AND IMAGE BUTTONS \\\\\\\\ void setup() { size(966, 1200); btnStart = new GButton(this, 963, 1197, 30, 30, "Butt."); bg = loadImage("GFmap1200.png"); cursor(CROSS); String[] files;

    files = new String[] { "Route1.png", "Route1over.png", "Route1mouseDown.png" }; btnRou1 = new GImageButton(this, 125, 46, files, "Route1mask.png");

    files = new String[] { "Route2.png", "Route2over.png", "Route2mouseDown.png" }; btnRou2 = new GImageButton(this, 51, 245, files, "Route2mask.png");

    files = new String[] { "Route3.png", "Route3over.png", "Route3mouseDown.png" }; btnRou3 = new GImageButton(this, 632, 107, files, "Route3mask.png");

    files = new String[] { "Route4.png", "Route4over.png", "Route4mouseDown.png" }; btnRou4 = new GImageButton(this, 355, 250, files, "Route4mask.png");

    files = new String[] { "Route5.png", "Route5over.png", "Route5mouseDown.png" }; btnRou5 = new GImageButton(this, 125, 221, files, "Route5mask.png");

    lblOut = new GLabel(this, 10, 190, 560, 20, ""); lblOut.setTextAlign(GAlign.CENTER, null); timer = millis() - 5000; }

    /////////////// IMAGE BACKGROUND WINDOW ONE \\\\\\\\ void draw() { background(bg); //Color values in RGB // Only display button info for 4 seconds if (millis() - timer > 4000) { lblOut.setText("Choose a Route"); } }

    public void createWindows(){ //int col; window = new GWindow [1]; for (int i = 0; i < 1; i++) { bg2 = loadImage("wiggleyourbigtoe620.png"); window[i] = GWindow.getWindow(this, "Window "+i, 70+i220, 160+i50, 640, 256, JAVA2D); window[i].addData(new MyWinData()); //((MyWinData)window[i].data).col = col;
    window[i].addDrawHandler(this, "windowDraw"); window[i].addMouseHandler(this, "windowMouse"); window[i].addKeyHandler(this, "myKeyPress"); movie = new Movie(this, "Wiggleyourbigtoe.mp4"); movie.stop(); movie2 = new Movie(this, "killbill01.mp4"); movie2.stop(); movie3 = new Movie(this, "killbill02.mp4"); movie3.stop(); movie4 = new Movie(this, "killbill03.mp4"); movie4.stop(); }
    }

    void handleButtonEvents(GImageButton button, GEvent event) { if (button == btnRou1) { movie.jump(0); movie.play(); } else if (button == btnRou2){ movie2.jump(0); movie2.play(); } else if (button == btnRou3){ movie3.jump(0); movie3.play(); } else if (button == btnRou4){ movie4.jump(0); movie4.play(); } else if (button == btnRou5) lblOut.setText("Route 5 Button working"); timer = millis(); }

    public void handleButtonEvents(GButton button, GEvent event) { if (window == null && event == GEvent.CLICKED) { createWindows(); //lblInstr.setVisible(true); button.setEnabled(false); } }

    public void windowDraw(PApplet appc, GWinData data) { bg2 = loadImage("wiggleyourbigtoe620.png"); //MyWinData data2 = (MyWinData)data; appc.background(bg2); /////////// if (movie.available()) { movie.read(); } appc.image(movie, 0, 0); //if btnRou1 if (movie2.available()) { movie2.read(); } appc.image(movie2, 0, 0); /////////////// if(movie3.available()){ movie3.read(); } appc.image(movie3, 0, 0); //////////////
    if (movie4.available()) { movie4.read(); } appc.image(movie4, 0, 0); /////////

    }

    class MyWinData extends GWinData {
    boolean done; int col; }

    public void myKeyPress(PApplet appc, GWinData data, KeyEvent kevent) { switch(appc.key) { case ESC: appc.key = 0; break; } println("You are trapped."); }

    public void keyPressed() { switch(key) { case ESC: key = 0; break; } println("You are very trapped."); }

Sign In or Register to comment.