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);
  }
Example #2
0
  /**
   * Creates the window, sets up the fonts and the libraries. Aligns all the buttons, backgrounds
   * and the text.
   */
  public void setup() {

    // Create window
    size(600, 500);

    // Select Fonts
    arialMain = createFont("ArialBold", 32);
    arialB = createFont("Arial", 16);

    // Set the controller
    cp5 = new ControlP5(this);

    // Main Menu text
    cp5.addTextlabel("mainText")
        .setPosition(width / 2 - 85, 30)
        .setText("Main Menu")
        .setFont(arialMain)
        .setColor(200);

    // Help Button
    buttonHelp = createButton("buttonHelp", "Help", 55, 85, 60);

    // Tournament Button
    buttonTournament = createButton("buttonTournament", "Tournament", 220, 85, 27);

    // Random Map Button
    createMap = createButton("createMap", "Random Map", 385, 85, 22);

    // A group to store all the brain related objects
    Group antBrains =
        cp5.addGroup("antBrains")
            .setBackgroundColor(color(0, 64))
            .setBackgroundHeight(270)
            .setWidth(490)
            .setTitle("Ant brain, you choose.")
            .setColorBackground(color(0, 100))
            .setPosition(55, 125)
            .hideArrow()
            .hideBar();

    // Load the background image for the brain group
    bg = loadImage("brainsbg.png");

    // A button is used to store the background image for the brain group.
    bgBrain =
        cp5.addButton("bgBrain")
            .setPosition(0, 0)
            .setImages(bg, bg, bg)
            .updateSize()
            .moveTo(antBrains)
            .setOff();

    // Select Red Brain Button
    selectRedBrain =
        createSelectButton("selectRedBrain", "Select Brain", 490 / 4 - 50, 140).moveTo(antBrains);

    // Select Black Brain Button
    selectBlackBrain =
        createSelectButton("selectBlackBrain", "Select Brain", 490 / 4 * 3 - 50, 140)
            .moveTo(antBrains);

    // Select Map Button
    selectMap =
        cp5.addButton("selectMap")
            .setPosition(0, 232)
            .setSize(490, 35)
            .setColorBackground(color(0, 200))
            .setColorActive(color(0, 200))
            .setColorForeground(color(0, 150))
            .moveTo(antBrains);

    // Set text and font options for the Select Map Button
    selectMap
        .getCaptionLabel()
        .setFont(arialB)
        .setText("Select Map")
        .toUpperCase(false)
        .setSize(18)
        .setColor(color(140))
        .getStyle()
        .setMarginLeft(190);

    // Start Button
    startButton =
        cp5.addButton("startButton")
            .setPosition(55, 400)
            .setSize(490, 65)
            .setColorBackground(color(115, 73, 73))
            .setColorActive(color(215, 73, 73))
            .setColorForeground(color(115, 73, 73))
            .lock();

    // Set text and font options for the Start Button
    startButton
        .getCaptionLabel()
        .setFont(arialB)
        .setText("START")
        .toUpperCase(false)
        .setSize(38)
        .setColor(color(140))
        .getStyle()
        .setMarginLeft(180);

    // Load the main background image
    bgMain = loadImage("bg.jpg");

    // Creates all the temporary files;
    createTempDir();
  }