fixed text, added resolution info in gui

This commit is contained in:
2022-06-25 17:34:41 +02:00
parent 50ce48c480
commit 565c7a3bc9
4 changed files with 52 additions and 44 deletions

View File

@@ -69,8 +69,8 @@ public class SecondApplet extends PApplet {
void CP5_pauseAllAction() {
for(int i = 0; i < bricks.size(); i++){
if(!bricks.get(i).paused) bricks.get(i).playPause();
for (int i = 0; i < bricks.size(); i++) {
if (!bricks.get(i).paused) bricks.get(i).playPause();
}
}
@@ -81,6 +81,10 @@ public class SecondApplet extends PApplet {
image(bin, binX, binY, binS, binS);
stroke(255);
strokeWeight(1);
textSize(25);
fill(255);
text(renderer.width + "x" + renderer.height, 100, height-18);
textSize(10);
line(0, height-120, width, height-120);
totalBrickHeight = 0;
for (int i = 0; i < shaderList.size(); i++) {
@@ -106,7 +110,7 @@ public class SecondApplet extends PApplet {
}
cp5.setPosition(0, height-120);
binY = height-85;
binY = height-87;
}
class shaderManager {
@@ -196,10 +200,10 @@ public class SecondApplet extends PApplet {
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
}
pauseStates = new boolean[slider.size()];
for(int i = 0; i < pauseStates.length; i++){
for (int i = 0; i < pauseStates.length; i++) {
pauseStates[i] = false;
}
if(!spawnPlaying){
if (!spawnPlaying) {
playPause();
}
}
@@ -224,9 +228,9 @@ public class SecondApplet extends PApplet {
slider.get(sliderNo).setLabel(param.name);
}
void playPause(){
void playPause() {
paused = !paused;
if(paused){
if (paused) {
pauseAllSliders();
} else {
resumeAllSliders();
@@ -239,9 +243,9 @@ public class SecondApplet extends PApplet {
slider.get(i).animated = false;
}
}
void resumeAllSliders(){
for(int i = 0; i < slider.size(); i++){
void resumeAllSliders() {
for (int i = 0; i < slider.size(); i++) {
slider.get(i).animated = pauseStates[i];
}
}
@@ -252,14 +256,14 @@ public class SecondApplet extends PApplet {
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){
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){
if (mouseX > 25 && mouseX < 37 && mouseY > 4+totalBrickHeight && mouseY < 4+totalBrickHeight+13) {
hoverPauseButton = true;
} else {
hoverPauseButton = false;
@@ -307,16 +311,16 @@ public class SecondApplet extends PApplet {
rect(0, totalBrickHeight, width, h);
fill(255);
text(name, 40, 10+totalBrickHeight, 10);
text(name, 40, 13+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);
rect(25, 4+totalBrickHeight, 10, 10);
for (int i = 0; i < slider.size(); i++) {
slider.get(i).display();
@@ -438,7 +442,7 @@ public class SecondApplet extends PApplet {
fill(185+(40*int(hovering)));
rect(x, y, map(value, minVal, maxVal, 0, w), h);
fill(255);
text(label, x+5, y+7);
text(label, x+5, y+10);
if (animated) {
fill(185+(40*int(hovering_anim_btn)));
@@ -546,8 +550,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();
if (bricks.get(i).hoverActiveButton) bricks.get(i).active = !bricks.get(i).active;
if (bricks.get(i).hoverPauseButton) bricks.get(i).playPause();
}
}
void mouseDragged() {
@@ -597,4 +601,11 @@ public class SecondApplet extends PApplet {
pressedSlider = -1;
pressedBrick = -1;
}
void mouseWheel(MouseEvent event) {
if (event.getCount() < 0) renderSize += 8;
else renderSize -= 8;
renderSize = constrain(renderSize, 8, 15000);
}
}