package creeper_Behavior_P3_2_3D_SET3;
import processing.core.PApplet;
import controlP5.*;
public class Culebra_Interface extends PApplet {
int w, h;
PApplet parent;
ControlP5 cp5;
int abc = 100;
public Knob Blend, MBaseSpeed, MSpeed, MaxRep,MaxAtt,Att,Rep,MaxConn,ConnDist;
public RadioButton behavior, spawn, dimension;
public CheckBox checkFlockBox, checkPerlinBox;
public Culebra_Interface(PApplet _parent, int theWidth, int theHeight) {
super();
parent = _parent;
w = theWidth;
h = theHeight;
PApplet.runSketch(new String[] { this.getClass().getName() }, this);
}
public void settings() {
size(w, h);
}
public void setup() {
surface.setLocation(10, 10);
cp5 = new ControlP5(this);
cp5.setColorForeground(color(0, 255, 0));
cp5.setColorValueLabel(color(255, 255, 255));
cp5.setBackground(color(0, 0, 0));
cp5.setColorActive(color(0, 255, 0));
cp5.setColorBackground(color(50, 50, 50));
Button b0 = cp5.addButton("SPAWN CONTROLS").plugTo(parent).setPosition(10, 10).setSize(100, 20);
b0.setColorActive(color(0, 255, 0));
b0.setColorBackground(color(255, 0, 0));
float[] spawn_default = new float[3];
spawn_default[0] = 0.0f;
spawn_default[1] = 1.0f;
spawn_default[2] = 0.0f;
spawn = cp5.addRadioButton("spawnType").setPosition(10, 40).setSize(20, 9).addItem("ALIGNED_LEFT", 0)
.addItem("SCATTERED", 1).addItem("SCATTERED GROUND", 2).setArrayValue(spawn_default);
Button b01 = cp5.addButton("BEHAVIOR CONTROLS").plugTo(parent).setPosition(120, 10).setSize(100, 20);
b01.setColorActive(color(0, 255, 0));
b01.setColorBackground(color(255, 0, 0));
float[] beh_default = new float[5];
beh_default[0] = 1.0f;
beh_default[1] = 0.0f;
beh_default[2] = 0.0f;
beh_default[3] = 0.0f;
beh_default[4] = 0.0f;
behavior = cp5.addRadioButton("behaviorType").setPosition(120, 40).setSize(20, 9).addItem("FLOCKING", 0)
.addItem("PERLIN", 1).addItem("HYBRID", 2).addItem("MODIFIEDPERLIN", 3).addItem("DUAL", 4)
.setArrayValue(beh_default);
Button b02 = cp5.addButton("DIMENSION CONTROLS").plugTo(parent).setPosition(230, 10).setSize(100, 20);
b02.setColorActive(color(0, 255, 0));
b02.setColorBackground(color(255, 0, 0));
Button b03 = cp5.addButton("BOUNDS").plugTo(parent).setPosition(340, 10).setSize(275, 20);
b03.setColorActive(color(0, 255, 0));
b03.setColorBackground(color(255, 0, 0));
Slider s20 = cp5.addSlider("BoundsWidth").plugTo(parent).setRange(100, 5000).setPosition(340, 40)
.setValue(1000.00f).setDecimalPrecision(2).setSize(200, 10);
Slider s21 = cp5.addSlider("BoundsDepth").plugTo(parent).setRange(100, 5000).setPosition(340, 60)
.setValue(1000.00f).setDecimalPrecision(2).setSize(200, 10);
Slider s22 = cp5.addSlider("BoundsHeight").plugTo(parent).setRange(100, 5000).setPosition(340, 80)
.setValue(1000.00f).setDecimalPrecision(2).setSize(200, 10);
float[] dim_default = new float[2];
dim_default[0] = 1.0f;
dim_default[1] = 0.0f;
dimension = cp5.addRadioButton("dimension").setPosition(230, 40).setSize(20, 9).addItem("2D", 0)
.addItem("3D", 1).setArrayValue(dim_default);
Slider s2 = cp5.addSlider("Velocity").plugTo(parent).setRange(0, 50).setPosition(10, 95).setValue(1.5f)
.setDecimalPrecision(1).setSize(200, 10);
Button b = cp5.addButton("FLOCKING CONTROLS").plugTo(parent).setPosition(10, 110).setSize(270, 20);
b.setColorActive(color(0, 255, 0));
b.setColorBackground(color(255, 0, 0));
Button bz = cp5.addButton("TAILCHASERS CONTROLS").plugTo(parent).setPosition(290, 110).setSize(320, 20);
bz.setColorActive(color(0, 255, 0));
bz.setColorBackground(color(255, 0, 0));
cp5.addToggle("Connect").plugTo(parent).setPosition(10, 135).setSize(50, 10).setValue(false)
.setMode(ControlP5.SWITCH);
cp5.addToggle("F_Bounds").plugTo(parent).setPosition(70, 135).setSize(50, 10).setValue(true)
.setMode(ControlP5.SWITCH);
cp5.addToggle("Bounce_Rebirth").plugTo(parent).setPosition(130, 135).setSize(50, 10).setValue(true)
.setMode(ControlP5.SWITCH);
cp5.addToggle("Tail_Chaser").plugTo(parent).setPosition(200, 135).setSize(50, 10).setValue(false)
.setMode(ControlP5.SWITCH);
Slider s3 = cp5.addSlider("SearchRadius").plugTo(parent).setRange(0, 500).setPosition(10, 165).setValue(30.0f)
.setDecimalPrecision(2).setSize(200, 10);
Slider s4 = cp5.addSlider("AlignValue").plugTo(parent).setRange(0.00f, 1.00f).setPosition(10, 185)
.setValue(0.045f).setDecimalPrecision(3).setSize(200, 10);
Slider s5 = cp5.addSlider("SeparateValue").plugTo(parent).setRange(0.00f, 1.00f).setPosition(10, 205)
.setValue(0.09f).setDecimalPrecision(3).setSize(200, 10);
Slider s6 = cp5.addSlider("CohesionValue").plugTo(parent).setRange(0.00f, 1.00f).setPosition(10, 225)
.setValue(0.25f).setDecimalPrecision(3).setSize(200, 10);
Slider s7B = cp5.addSlider("Trail_ViewAngle").plugTo(parent).setRange(0.00f, 360.00f).setPosition(290, 165)
.setValue(60.0f).setDecimalPrecision(3).setSize(200, 10);
Slider s8B = cp5.addSlider("Follow_Coh_Range").plugTo(parent).setRange(0.00f, 500.00f).setPosition(290, 185)
.setValue(20.0f).setDecimalPrecision(3).setSize(200, 10);
Slider s9B = cp5.addSlider("Follow_Coh_Mag").plugTo(parent).setRange(0.00f, 1.00f).setPosition(290, 205)
.setValue(0.5f).setDecimalPrecision(3).setSize(200, 10);
Slider s10B = cp5.addSlider("Follow_Sep_Range").plugTo(parent).setRange(0.00f, 500.00f).setPosition(290, 225)
.setValue(5.00f).setDecimalPrecision(3).setSize(200, 10);
Slider s11B = cp5.addSlider("Follow_Sep_Mag").plugTo(parent).setRange(0.00f, 1.00f).setPosition(290, 245)
.setValue(1.00f).setDecimalPrecision(3).setSize(200, 10);
MaxRep = cp5.addKnob("Max_Rep", 0.0f, 10.0f, 10.0f, 290, 260, 40);
MaxAtt = cp5.addKnob("Max_Att", 0.0f, 1.0f, 0.05f, 340, 260, 40);
Rep = cp5.addKnob("Repulsion", 0.0f, 10.0f, 5.0f, 390, 260, 40);
Att = cp5.addKnob("Attraction", 0.0f, 10.0f, 1.0f, 440, 260, 40);
cp5.addToggle("Enable_Influence").plugTo(parent).setPosition(290, 135).setSize(50, 10).setValue(false)
.setMode(ControlP5.SWITCH);
ConnDist = cp5.addKnob("ConnDist", 0.0f, 500.0f, 30.0f, 490, 260, 40);
MaxConn = cp5.addKnob("MaxConn", 0.0f, 300.0f, 20.0f, 540, 260, 40);
Button b4 = cp5.addButton("PERLIN CONTROLS").plugTo(parent).setPosition(10, 320).setSize(270, 20);
b4.setColorActive(color(0, 255, 0));
b4.setColorBackground(color(255, 0, 0));
Slider ps3 = cp5.addSlider("Multiplier").plugTo(parent).setRange(0, 10).setPosition(10, 375).setValue(0.0f)
.setDecimalPrecision(2).setSize(200, 10);
Slider ps4 = cp5.addSlider("Strength").plugTo(parent).setRange(0.00f, 100.00f).setPosition(10, 395)
.setValue(7.00f).setDecimalPrecision(3).setSize(200, 10);
Slider ps5 = cp5.addSlider("Scale").plugTo(parent).setRange(0.00f, 1000.00f).setPosition(10, 415)
.setValue(800.00f).setDecimalPrecision(3).setSize(200, 10);
Slider ps6 = cp5.addSlider("Mod_Mult").plugTo(parent).setRange(0.00f, 100.00f).setPosition(10, 435)
.setValue(10.00f).setDecimalPrecision(3).setSize(200, 10);
cp5.addToggle("Bounds").plugTo(parent).setPosition(10, 345).setSize(50, 10).setValue(false)
.setMode(ControlP5.SWITCH);
cp5.addToggle("Mod_Type_0").plugTo(parent).setPosition(70, 345).setSize(50, 10).setValue(true)
.setMode(ControlP5.SWITCH);
cp5.addToggle("Mod_Type_1").plugTo(parent).setPosition(130, 345).setSize(50, 10).setValue(false)
.setMode(ControlP5.SWITCH);
cp5.addToggle("Mod_Type_2").plugTo(parent).setPosition(190, 345).setSize(50, 10).setValue(false)
.setMode(ControlP5.SWITCH);
Button b5 = cp5.addButton("VIZ CONTROLS").plugTo(parent).setPosition(10, 450).setSize(270, 20);
b5.setColorActive(color(0, 255, 0));
b5.setColorBackground(color(255, 0, 0));
cp5.addToggle("ApplySweetColor").plugTo(parent).setPosition(10, 475).setSize(50, 10).setValue(true)
.setMode(ControlP5.SWITCH);
Slider s7 = cp5.addSlider("HeadWidth").plugTo(parent).setRange(0.00f, 8.0f).setPosition(10, 505).setValue(1.0f)
.setDecimalPrecision(2).setSize(200, 10);
Slider s8 = cp5.addSlider("StrokeWidth").plugTo(parent).setRange(0.00f, 10).setPosition(10, 525).setValue(3.0f)
.setDecimalPrecision(2).setSize(200, 10);
Slider s9 = cp5.addSlider("Transparency").plugTo(parent).setRange(0.00f, 255).setPosition(10, 545)
.setValue(255.0f).setDecimalPrecision(2).setSize(200, 10);
Slider s10 = cp5.addSlider("Count").plugTo(parent).setRange(0.00f, 50000).setPosition(10, 565).setValue(500)
.setDecimalPrecision(0).setSize(200, 10);
Slider s12 = cp5.addSlider("TrailResolution").plugTo(parent).setRange(1.00f, 50.00f).setPosition(10, 585)
.setValue(1.00f).setDecimalPrecision(1).setSize(200, 10);
Button b6 = cp5.addButton("HYBRID CONTROLS").plugTo(parent).setPosition(10, 600).setSize(270, 20);
b6.setColorActive(color(0, 255, 0));
b6.setColorBackground(color(255, 0, 0));
Blend = cp5.addKnob("Blend", 0.0f, 1.0f, 0.5f, 10, 630, 40);
MBaseSpeed = cp5.addKnob("Init Speed", 0.0f, 10.0f, 1.0f, 70, 630, 40);
MSpeed = cp5.addKnob("MaxSpeed", 0.0f, 15.0f, 2.0f, 130, 630, 40);
cp5.addToggle("Mod_Perlin").plugTo(parent).setPosition(190, 630).setSize(50, 10).setValue(false)
.setMode(ControlP5.SWITCH);
Button m0a = cp5.addButton("MAP BEHAVIORS").plugTo(parent).setPosition(10, 690).setSize(270, 20);
m0a.setColorActive(color(0, 255, 0));
m0a.setColorBackground(color(255, 0, 0));
cp5.addToggle("ApplyMap").plugTo(parent).setPosition(10, 720).setSize(50, 10).setValue(false)
.setMode(ControlP5.SWITCH);
cp5.addToggle("ShowMap").plugTo(parent).setPosition(70, 720).setSize(50, 10).setValue(false)
.setMode(ControlP5.SWITCH);
cp5.addToggle("Boundary").plugTo(parent).setPosition(130, 720).setSize(50, 10).setValue(false)
.setMode(ControlP5.SWITCH);
cp5.addToggle("Bounce_Spawn").plugTo(parent).setPosition(190, 720).setSize(50, 10).setValue(false)
.setMode(ControlP5.SWITCH);
Button m0 = cp5.addButton("FLOCKING MAP BEHAVIOR").plugTo(parent).setPosition(10, 750).setSize(250, 20);
this.checkFlockBox = cp5.addCheckBox("checkBox").setPosition(10, 780).setColorForeground(color(120))
.setColorActive(color(255)).setColorLabel(color(255)).setSize(20, 10).setItemsPerRow(3)
.setSpacingColumn(60).setSpacingRow(20).addItem("Align", 0.0f).addItem("Separate", 0.0f)
.addItem("Cohesion", 0.0f);
Button m01 = cp5.addButton("NOISE MAP BEHAVIOR").plugTo(parent).setPosition(10, 800).setSize(250, 20);
this.checkPerlinBox = cp5.addCheckBox("checkBoxPerlin").setPosition(10, 830).setColorForeground(color(120))
.setColorActive(color(255)).setColorLabel(color(255)).setSize(20, 10).setItemsPerRow(3)
.setSpacingColumn(60).setSpacingRow(20).addItem("StrengthVal", 0.0f).addItem("ScaleVal", 0.0f)
.addItem("MultiplierVal", 0.0f);
Button resetIt = cp5.addButton("RESET").plugTo(parent).setPosition(10, 850).setSize(250, 40);
resetIt.setColorActive(color(0,255,0));
resetIt.setColorBackground(color(255,255,0));
resetIt.setColorLabel(color(0));
s2.setColorActive(color(255, 0, 0));
s3.setColorActive(color(255, 0, 0));
s4.setColorActive(color(255, 0, 0));
s5.setColorActive(color(255, 0, 0));
s6.setColorActive(color(255, 0, 0));
s7.setColorActive(color(255, 0, 0));
s8.setColorActive(color(255, 0, 0));
s9.setColorActive(color(255, 0, 0));
s10.setColorActive(color(255, 0, 0));
s12.setColorActive(color(255, 0, 0));
s21.setColorActive(color(255, 0, 0));
s22.setColorActive(color(255, 0, 0));
ps3.setColorActive(color(255, 0, 0));
ps4.setColorActive(color(255, 0, 0));
ps5.setColorActive(color(255, 0, 0));
ps6.setColorActive(color(255, 0, 0));
}
public void draw() {
background(0);
}
}
Update