SWITCHING Between Videos Processing Issue
in
Contributed Library Questions
•
9 months ago
Pleease help
I have it so the "tdogg" video appears on start-up and then using the Key press method it switches from videos, but when I change
keyPressed to a new statement I'm not sure how and where to define it to make it work. I have a command coming in from OSCulator which defines that, but then I feel I need to start using booleans etc. which is where I get confused. Can something PLEASE tell me where I am going wrong!?
In desperate need of help, and I know how good you guys are with Processing, thanks so much!
- import codeanticode.gsvideo.*; // import GSvideo Library
- import oscP5.*; // import oscP5 Library
- import netP5.*; // import netP5 Library (part of oscP5 Library)
- OscP5 osculator;
- GSMovie player;
- //global variables
- int direction;
- boolean pressUp;
- boolean pressRight;
- boolean pressLeft;
- public void setup() {
- size(640, 480);
- background(0);
- // osculator setup
- osculator = new OscP5(this, 9000);
- osculator.plug(this, "buttonLeft", "/wii/1/button/Left");
- osculator.plug(this, "buttonRight", "/wii/1/button/Right");
- osculator.plug(this, "buttonUp", "/wii/1/button/Up");
- // GSvideo setup
- player = new GSMovie(this, "tdogg.mov");
- player.loop();
- }
- void draw() {
- image(player, 0, 0, width, height);
- if (pressLeft){
- buttonLeft();
- }
- if (pressRight){
- buttonRight();
- }
- if (pressUp){
- buttonUp();
- }
- }
- // THIS KEY PRESS WORKS FINE
- void keyPressed() {
- if (key == '1') { player = new GSMovie (this, "tdogg.mov");}
- if (key == '2') { player = new GSMovie (this, "transit.mov");}
- if (key == '3') { player = new GSMovie (this, "bunny.mov");}
- movie.loop();
- }
- //I TRIES TO REPLICATE THE WORKING KEYPRESS WITH MY OWN STATEMENTS
- void buttonLeft() {
- player = new GSMovie (this, "tdogg.mov");
- }
- void buttonRight() {
- player = new GSMovie (this, "bunny.mov");
- }
- void buttonUp () {
- player = new GSMovie (this, "transit.mov");
- }
1