|
|
@@ -35,11 +35,11 @@ public class SecondApplet extends PApplet { |
|
|
|
Toggle auto = cp5.addToggle("spawn playing") |
|
|
|
.setPosition(100, height-85) |
|
|
|
.setSize(15, 15) |
|
|
|
.plugTo(this, "CP5_spawnPlayingAction") |
|
|
|
.setValue(false); |
|
|
|
.setValue(true) |
|
|
|
.plugTo(this, "CP5_spawnPlayingAction"); |
|
|
|
auto.getCaptionLabel().getStyle().setMargin(-17, 0, 0, 20); |
|
|
|
|
|
|
|
Toggle pauseAll = cp5.addToggle("pause all") |
|
|
|
Bang pauseAll = cp5.addBang("pause all") |
|
|
|
.setPosition(100, height-65) |
|
|
|
.setSize(15, 15) |
|
|
|
.plugTo(this, "CP5_pauseAllAction"); |
|
|
@@ -69,7 +69,9 @@ public class SecondApplet extends PApplet { |
|
|
|
|
|
|
|
|
|
|
|
void CP5_pauseAllAction() { |
|
|
|
//pauseAll = !pauseAll; |
|
|
|
for(int i = 0; i < bricks.size(); i++){ |
|
|
|
if(!bricks.get(i).paused) bricks.get(i).playPause(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@@ -114,10 +116,7 @@ public class SecondApplet extends PApplet { |
|
|
|
shader.pos = shaderList.size()-1; |
|
|
|
bricks.add(new Brick(shaderList.size()-1, shaderList.get(shaderList.size()-1).params, shader.name)); |
|
|
|
refreshSurface(0); |
|
|
|
if (!spawnPlaying) bricks.get(shaderList.size()-1).pauseAllSliders(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (!spawnPlaying) bricks.get(shaderList.size()-1).pauseAllSliders(); |
|
|
|
println("Added " + shader + " to fxList at spot. List length: " + shaderList.size()); |
|
|
|
} |
|
|
|
|
|
|
@@ -168,6 +167,7 @@ public class SecondApplet extends PApplet { |
|
|
|
} |
|
|
|
} |
|
|
|
catch(Exception e) { |
|
|
|
println("Warning: Brick not yet loaded"); |
|
|
|
} |
|
|
|
if (i > maxFx) break; |
|
|
|
} |
|
|
@@ -178,7 +178,8 @@ public class SecondApplet extends PApplet { |
|
|
|
class Brick { |
|
|
|
ArrayList<Slider> slider = new ArrayList<Slider>(); |
|
|
|
ArrayList<Param> params = new ArrayList<Param>(); |
|
|
|
boolean active, dragging, dragHovering, hovering, hoveringLineAbove, hoveringLineBelow; |
|
|
|
boolean active, paused, dragging, dragHovering, hovering, hoveringLineAbove, hoveringLineBelow, hoverActiveButton, hoverPauseButton; |
|
|
|
boolean[] pauseStates; |
|
|
|
color brickBGcol; |
|
|
|
int pos; |
|
|
|
int h, y; |
|
|
@@ -194,7 +195,13 @@ public class SecondApplet extends PApplet { |
|
|
|
for (int i = 0; i < params.size(); i++) { |
|
|
|
slider.add(new Slider(10, 20+(20*i)+y, 230, 12, params.get(i).minValue, params.get(i).maxValue, params.get(i).name, params.get(i).type, params.get(i).osciModes)); //add possible waves to slider |
|
|
|
} |
|
|
|
println(totalBrickHeight + " " + h); |
|
|
|
pauseStates = new boolean[slider.size()]; |
|
|
|
for(int i = 0; i < pauseStates.length; i++){ |
|
|
|
pauseStates[i] = false; |
|
|
|
} |
|
|
|
if(!spawnPlaying){ |
|
|
|
playPause(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void setPos(int pos_) { |
|
|
@@ -217,17 +224,45 @@ public class SecondApplet extends PApplet { |
|
|
|
slider.get(sliderNo).setLabel(param.name); |
|
|
|
} |
|
|
|
|
|
|
|
void playPause(){ |
|
|
|
paused = !paused; |
|
|
|
if(paused){ |
|
|
|
pauseAllSliders(); |
|
|
|
} else { |
|
|
|
resumeAllSliders(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void pauseAllSliders() { |
|
|
|
for (int i = 0; i < slider.size(); i++) { |
|
|
|
pauseStates[i] = slider.get(i).animated; |
|
|
|
slider.get(i).animated = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void resumeAllSliders(){ |
|
|
|
for(int i = 0; i < slider.size(); i++){ |
|
|
|
slider.get(i).animated = pauseStates[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void update() { |
|
|
|
boolean sliderHover = false; |
|
|
|
for (int i = 0; i < slider.size(); i++) { |
|
|
|
if (slider.get(i).hovering || slider.get(i).hovering_anim_btn) |
|
|
|
sliderHover = true; |
|
|
|
if (slider.get(i).hovering || slider.get(i).hovering_anim_btn) sliderHover = true; |
|
|
|
if (paused && slider.get(i).animated) paused = false; |
|
|
|
} |
|
|
|
|
|
|
|
if(mouseX > 10 && mouseX < 22 && mouseY > 4+totalBrickHeight && mouseY < 4+totalBrickHeight+13){ |
|
|
|
hoverActiveButton = true; |
|
|
|
} else { |
|
|
|
hoverActiveButton = false; |
|
|
|
} |
|
|
|
|
|
|
|
if(mouseX > 25 && mouseX < 37 && mouseY > 4+totalBrickHeight && mouseY < 4+totalBrickHeight+13){ |
|
|
|
hoverPauseButton = true; |
|
|
|
} else { |
|
|
|
hoverPauseButton = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (mouseY > y-5 && mouseY < y+5 && pressedBrick != -1) { |
|
|
@@ -240,7 +275,7 @@ public class SecondApplet extends PApplet { |
|
|
|
} else { |
|
|
|
hoveringLineBelow = false; |
|
|
|
hoveringLineAbove = false; |
|
|
|
if (mouseY > totalBrickHeight && mouseY < totalBrickHeight+h && !sliderHover) { |
|
|
|
if (mouseY > totalBrickHeight && mouseY < totalBrickHeight+h && !sliderHover && !hoverActiveButton && !hoverPauseButton) { |
|
|
|
hovering = true; |
|
|
|
} else { |
|
|
|
hovering = false; |
|
|
@@ -272,12 +307,16 @@ public class SecondApplet extends PApplet { |
|
|
|
rect(0, totalBrickHeight, width, h); |
|
|
|
|
|
|
|
fill(255); |
|
|
|
text(name, 25, 10+totalBrickHeight, 10); |
|
|
|
text(name, 40, 10+totalBrickHeight, 10); |
|
|
|
|
|
|
|
stroke(255); |
|
|
|
if (active) fill(185); |
|
|
|
else noFill(); |
|
|
|
rect(10, 4+totalBrickHeight, 10, 10); |
|
|
|
|
|
|
|
if (paused) fill(185); |
|
|
|
else noFill(); |
|
|
|
rect(25,4+totalBrickHeight, 10, 10); |
|
|
|
|
|
|
|
for (int i = 0; i < slider.size(); i++) { |
|
|
|
slider.get(i).display(); |
|
|
@@ -507,6 +546,8 @@ public class SecondApplet extends PApplet { |
|
|
|
if (bricks.get(i).hovering) { |
|
|
|
bricks.get(i).press(); |
|
|
|
} |
|
|
|
if(bricks.get(i).hoverActiveButton) bricks.get(i).active = !bricks.get(i).active; |
|
|
|
if(bricks.get(i).hoverPauseButton) bricks.get(i).playPause(); |
|
|
|
} |
|
|
|
} |
|
|
|
void mouseDragged() { |