public void setup() { size(800, 600); background(255); // Local variables to set where the components will be int margin = 16; int spacing = 36; int w = 128; int h = 32; // Initialize ControlP5 controlP5 = new ControlP5(this); // Set the color of the labels controlP5.setColorLabel(color(255, 0, 0)); // Add components controlP5.addButton("Clear Screen", 1, margin, spacing, w, h); controlP5.addSlider("Leaf Red", 0, 255, 255, margin, spacing * 2, w, h); controlP5.addSlider("Leaf Green", 0, 255, 64, margin, spacing * 3, w, h); controlP5.addSlider("Leaf Blue", 0, 255, 0, margin, spacing * 4, w, h); controlP5.addSlider("Branch Random", 0, PI, PI / 4, margin, spacing * 5, w, h); controlP5.addSlider("Leaf Random", 0, 32, 16, margin, spacing * 6, w, h); controlP5.addSlider("Leaf Size", 0, 32, 16, margin, spacing * 7, w, h); controlP5.addSlider("Start Size", 0, 128, 64, margin, spacing * 8, w, h); }
public void setup() { size(1024, 768); background(0); frameRate(30); smooth(); drawVectors = false; paused = true; timeline = new Timeline(); sim = new GravitySimulation(); sun = new Star(5000, 25, new PVector(300, 500), new PVector(0, 0), 0, "sun"); planet = new Planet(10, 10, new PVector(500, 500), new PVector(0, 40), "planet"); planet2 = new Planet(50, 10, new PVector(150, 500), new PVector(0, -40), "planet2"); timeline.registerStatefulObject(sun); timeline.registerStatefulObject(planet); timeline.registerStatefulObject(planet2); controlP5 = new ControlP5(this); btnRewind = controlP5.addButton("btnRewind_OnClick", 0, 800, 20, 50, 20); btnRewind.setLabel("Rewind"); btnPlayPause = controlP5.addButton("btnPlayPause_OnClick", 0, 860, 20, 50, 20); btnPlayPause.setLabel("Play"); btnFastForward = controlP5.addButton("btnFastForward_OnClick", 0, 920, 20, 80, 20); btnFastForward.setLabel("Fast Forward"); sliderTimeline = controlP5.addSlider("sliderTimeline_OnClick", 0, 10000, 0, 20, 720, 900, 10); sliderTimeline.setLabel("Timeline"); }
public void GUISetup() { // set up GUI String[] outputs = MidiBus.availableOutputs(); String[] inputs = MidiBus.availableInputs(); controlP5 = new ControlP5(this); programlabel = controlP5.addTextlabel("programlabel", "Programs", 350, 65); Radio programs = controlP5.addRadio("programs", 350, 80); programs.deactivateAll(); programs.add("on", 1); programs.add("off", 2); programs.add("oscillate", 0); programs.add("fade", 4); programs.add("random", 3); midioutlabel = controlP5.addTextlabel("midioutlabel", "MIDI Outputs", 200, 65); Radio midioutdevices = controlP5.addRadio("midioutdevices", 200, 80); midioutdevices.deactivateAll(); for (int i = 0; i < (outputs.length - 1); i++) { midioutdevices.add(outputs[i], i); } midiinlabel = controlP5.addTextlabel("midiinlabel", "MIDI Inputs", 100, 65); Radio midiindevices = controlP5.addRadio("midiindevices", 100, 80); midiindevices.deactivateAll(); for (int i = 0; i < (inputs.length - 1); i++) { midiindevices.add(inputs[i], i); } options = controlP5.addTextlabel("options", "Options", 10, 65); optionsbox = controlP5.addCheckBox("optionsbox", 10, 80); optionsbox.setItemsPerRow(3); optionsbox.setSpacingColumn(30); optionsbox.setSpacingRow(10); optionsbox.addItem("notes -> cc", 0); heading = controlP5.addTextlabel("heading", "grmnygrmny.lightarray", 200, 20); }
public void setup() { size(800, 500); ball = new Ball(width / 2, height / 2, new PVector(5, 5)); rectMode(CENTER); paddles = new Paddle[2]; paddles[0] = new Paddle(width - 40, 20); paddles[1] = new Paddle(40, 20); setupContext(); skeleton = new TSSkeleton(); cp5 = new ControlP5(this); // cp5.addBang("restart").setPosition(350, 10).setSize(10, 10); d1 = cp5.addDropdownList("paddle1").setPosition(width - 150, 20); d2 = cp5.addDropdownList("paddle2").setPosition(50, 20); d3 = cp5.addDropdownList("1_or_2_player").setPosition(150, 20); d4 = cp5.addDropdownList("speed").setPosition(250, 20); jointNames = loadStrings("joints.txt"); d4.addItem("slow", 0); d4.addItem("fast", 1); d4.addItem("Jeez-us", 2); for (int i = 0; i < jointNames.length; i++) { d1.addItem(jointNames[i], i); d2.addItem(jointNames[i], i); } d3.addItem("one player", 0); d3.addItem("two players", 1); smooth(); println("SimpleOpenNI.SKEL_HEAD " + SimpleOpenNI.SKEL_HEAD); println("SimpleOpenNI.SKEL_LEFT_ANKLE " + SimpleOpenNI.SKEL_LEFT_ANKLE); println("SimpleOpenNI.SKEL_LEFT_COLLAR " + SimpleOpenNI.SKEL_LEFT_COLLAR); println("SimpleOpenNI.SKEL_LEFT_ELBOW " + SimpleOpenNI.SKEL_LEFT_ELBOW); println("SimpleOpenNI.SKEL_LEFT_FINGERTIP " + SimpleOpenNI.SKEL_LEFT_FINGERTIP); println("SimpleOpenNI.SKEL_LEFT_FOOT " + SimpleOpenNI.SKEL_LEFT_FOOT); println("SimpleOpenNI.SKEL_LEFT_HAND " + SimpleOpenNI.SKEL_LEFT_HAND); println("SimpleOpenNI.SKEL_LEFT_HIP " + SimpleOpenNI.SKEL_LEFT_HIP); println("SimpleOpenNI.SKEL_LEFT_KNEE " + SimpleOpenNI.SKEL_LEFT_KNEE); println("SimpleOpenNI.SKEL_LEFT_SHOULDER " + SimpleOpenNI.SKEL_LEFT_SHOULDER); println("SimpleOpenNI.SKEL_LEFT_WRIST " + SimpleOpenNI.SKEL_LEFT_WRIST); println("SimpleOpenNI.SKEL_NECK " + SimpleOpenNI.SKEL_NECK); println("SimpleOpenNI.SKEL_RIGHT_ANKLE " + SimpleOpenNI.SKEL_RIGHT_ANKLE); println("SimpleOpenNI.SKEL_RIGHT_COLLAR " + SimpleOpenNI.SKEL_RIGHT_COLLAR); println("SimpleOpenNI.SKEL_RIGHT_ELBOW " + SimpleOpenNI.SKEL_RIGHT_ELBOW); println("SimpleOpenNI.SKEL_RIGHT_FINGERTIP " + SimpleOpenNI.SKEL_RIGHT_FINGERTIP); println("SimpleOpenNI.SKEL_RIGHT_FOOT " + SimpleOpenNI.SKEL_RIGHT_FOOT); println("SimpleOpenNI.SKEL_RIGHT_HAND " + SimpleOpenNI.SKEL_RIGHT_HAND); println("SimpleOpenNI.SKEL_RIGHT_HIP " + SimpleOpenNI.SKEL_RIGHT_HIP); println("SimpleOpenNI.SKEL_RIGHT_KNEE " + SimpleOpenNI.SKEL_RIGHT_KNEE); println("SimpleOpenNI.SKEL_RIGHT_SHOULDER " + SimpleOpenNI.SKEL_RIGHT_SHOULDER); println("SimpleOpenNI.SKEL_RIGHT_WRIST " + SimpleOpenNI.SKEL_RIGHT_WRIST); println("SimpleOpenNI.SKEL_TORSO " + SimpleOpenNI.SKEL_TORSO); println("SimpleOpenNI.SKEL_WAIST " + SimpleOpenNI.SKEL_WAIST); translations = new int[jointNames.length]; translations[0] = 1; translations[1] = 19; translations[2] = 5; translations[3] = 7; translations[4] = 10; translations[5] = 20; translations[6] = 9; translations[7] = 17; translations[8] = 18; translations[9] = 6; translations[10] = 8; translations[11] = 2; translations[12] = 23; translations[13] = 11; translations[14] = 13; translations[15] = 16; translations[16] = 24; translations[17] = 15; translations[18] = 21; translations[19] = 22; translations[20] = 12; translations[21] = 14; translations[22] = 3; translations[23] = 4; font = loadFont("AlBayan-48.vlw"); textFont(font, 48); }
public void draw() { // display things // execute sceneManager stuff resetMatrix(); // beginCamera(); camera(); rotateX(HALF_PI); translate(globalCameraX, globalCameraY, globalCameraZ); /* rotation using a and d PMatrix3D foRealCameraMatrix=new PMatrix3D(); getMatrix(foRealCameraMatrix); */ // translate(0,-100, -400 ); // translate(0,0, 0 ); // rotate(sin(millis() * 0.001), 1,0,0); background(bGround); for (int i = 0; i < cameras.size(); i++) { // camPicker.start(i); //add picker to each cam picker.start(i); cameras.get(i).display(); } // camPicker.stop(); for (int i = cameras.size(); i < cameras.size() + characters.size(); i++) { // charPicker.start(i); picker.start(i); characters.get(i - cameras.size()).display(); } // charPicker.stop(); picker.stop(); // endCamera(); // int id = camPicker.get(mouseX, mouseY); // if (id > -1) { // for (int i=0; i<cameras.size(); i++) { // if (i == id) { // cameras.get(id).changeToSelectedColor(); // cameras.get(id).isSelected = true; // } else { // cameras.get(i).setDefaultColor(); // cameras.get(i).isSelected = false; // } // } // } // checks for rule violations int id = -1; for (int i = 0; i < cameras.size(); i++) { if (cameras.get(i).isSelected) { if (selectedRule == 0) rulesChecker.checkLineOfAction(cameras, characters, i); else if (selectedRule == 1) rulesChecker.checkThirtyDegreeRule(cameras, characters, i); else resetAllCams(); } } rulesChecker.checkCuttingOnAction(sm, timeline); rulesChecker.checkPacing(sm, timeline); /* This is for camera rotation using a and d resetMatrix(); pushMatrix(); setMatrix(myCamera); rotate(angle); getMatrix(); popMatrix; */ // have to rotate back to original orientation in order to properly display the drop-down menu rotateX(PI); rotateX(HALF_PI); controlP5.draw(); timeline.draw(); }