import mjs.processing.mobile.mvideo.*; import javax.microedition.lcdui.*; import processing.core.*; public class videoGUI extends PMIDlet { PContainer screen1; PContainer screen2; PButton button1; PButton button2; PLabel label1; PLabel label2; PContainer currentContainer; // Video position int videoFileX; int videoFileY; MVideo videoFile; void setup() { PFont font; font = loadFont("AkbarPlain-48.mvlw"); textFont(font); textAlign(CENTER); noLoop(); videoFile = new MVideo(this,"2.3g2"); // Center the video on the screen videoFileX = (width - videoFile.getWidth()); videoFileY = (height - videoFile.getHeight()); // Set location for both videos videoFile.location(videoFileX,videoFileY); screen1 = new PContainer(); screen2 = new PContainer(); button1 = new PButton("Done"); button2 = new PButton("Play"); button1.setBounds(10,10,100,40); button2.calculateBounds(30,30,width,height); button2.setBounds(width/2-button2.width/2,height/2-button2.height/ 2,button2.width,button2.height); screen1.add(button1); screen2.add(button2); label1 = new PLabel("join dominos"); label2 = new PLabel("are you ready? Then press play"); label1.setBounds(40,40,width,50); label2.setBounds(40, 40,width,50); screen1.add(label1); screen2.add(label2); screen1.initialize(); screen2.initialize(); currentContainer = screen1; } void playVideo() { videoFile.play(); } void timeToFrame() { videoFile.timeToFrame(30); } /*void seekFrame() { videoFile.seekFrame(30); } void fullscreen() { videoFile.fullscreen(); } */ void seekTime() { videoFile.seekTime(30); } void stopVideo() { videoFile.stop(); } void draw() { background(108,180,46); currentContainer.draw(); fill(0); int lineSpace = height/14; int y = lineSpace; text("Player #3",width/2,y); } void keyPressed() { switch(key) { case '2' : playVideo(); break; case '4' : timeToFrame(); break; case '5' : stopVideo(); break; // case '7' : seekFrame(); break; // case '8' : fullscreen(); break; case '9' : seekTime(); break; } //redraw(); } void keyReleased() { currentContainer.keyReleased(); } void libraryEvent(Object library, int event, Object data) { // Check which button it is (which object) if (library == button1) { // Switch the screen.. currentContainer = screen2; } else if (library == button2) { currentContainer = screen1; } } }