added function to change render resolution by typing the number in (need to have the GUI as active window), fixed a bug where adding a slow effect crashed the program if you add it first after changing the image
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
//globals
|
//globals
|
||||||
uptime = 117205446
|
uptime = 117233182
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ public class SecondApplet extends PApplet {
|
|||||||
|
|
||||||
//PApplet parent;
|
//PApplet parent;
|
||||||
/*SecondApplet(PApplet _parent){
|
/*SecondApplet(PApplet _parent){
|
||||||
super();
|
super();
|
||||||
this.parent = _parent;
|
this.parent = _parent;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public void settings() {
|
public void settings() {
|
||||||
size(275, 120);
|
size(275, 120);
|
||||||
@@ -134,7 +134,6 @@ public class SecondApplet extends PApplet {
|
|||||||
int totalBrickHeight;
|
int totalBrickHeight;
|
||||||
public void draw() {
|
public void draw() {
|
||||||
|
|
||||||
|
|
||||||
background(68, 68, 68);
|
background(68, 68, 68);
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
if (heightOverLimit) {
|
if (heightOverLimit) {
|
||||||
@@ -163,6 +162,15 @@ public class SecondApplet extends PApplet {
|
|||||||
textSize(25);
|
textSize(25);
|
||||||
fill(255);
|
fill(255);
|
||||||
text(renderer.width + "x" + renderer.height, 100, height-15);
|
text(renderer.width + "x" + renderer.height, 100, height-15);
|
||||||
|
if (typingNumber) {
|
||||||
|
rect(100, height - 35, textWidth(str(renderer.width) + "x" + str(renderer.height)), 25);
|
||||||
|
fill(0);
|
||||||
|
text(newResoString, 100, height-15);
|
||||||
|
fill(255);
|
||||||
|
if (frameCount >= numberTypedFrame+90) {
|
||||||
|
setTypedReso();
|
||||||
|
}
|
||||||
|
}
|
||||||
textSize(10);
|
textSize(10);
|
||||||
line(0, height-120, width, height-120);
|
line(0, height-120, width, height-120);
|
||||||
|
|
||||||
@@ -273,17 +281,17 @@ public class SecondApplet extends PApplet {
|
|||||||
renderSizeChanged = false;
|
renderSizeChanged = false;
|
||||||
|
|
||||||
for (int i = 0; i < shaderList.size(); i++) {
|
for (int i = 0; i < shaderList.size(); i++) {
|
||||||
//try {
|
try {
|
||||||
|
|
||||||
shaderList.get(i).getValuesFromGUI();
|
shaderList.get(i).getValuesFromGUI();
|
||||||
if (bricks.get(i).active) {
|
if (bricks.get(i).active) {
|
||||||
//shaderList.get(i).getValuesFromGUI();
|
//shaderList.get(i).getValuesFromGUI();
|
||||||
shaderList.get(i).shade();
|
shaderList.get(i).shade();
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
//catch(Exception e) {
|
catch(Exception e) {
|
||||||
// println("Warning: Brick not yet loaded");
|
println("Warning: Brick not yet loaded");
|
||||||
//}
|
}
|
||||||
if (i > maxFx) break;
|
if (i > maxFx) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -710,4 +718,35 @@ public class SecondApplet extends PApplet {
|
|||||||
}
|
}
|
||||||
textSize(10);
|
textSize(10);
|
||||||
}
|
}
|
||||||
|
int numberTypedFrame;
|
||||||
|
boolean typingNumber;
|
||||||
|
String newResoString;
|
||||||
|
void keyPressed() {
|
||||||
|
if (keyIsNumber(key) || key == BACKSPACE) {
|
||||||
|
numberTypedFrame = frameCount;
|
||||||
|
if (!typingNumber) {
|
||||||
|
typingNumber = true;
|
||||||
|
newResoString = "";
|
||||||
|
}
|
||||||
|
if (keyIsNumber(key)) newResoString += str(key);
|
||||||
|
else if ((newResoString != null) && (newResoString.length() > 0)) newResoString = newResoString.substring(0, newResoString.length() - 1);
|
||||||
|
}
|
||||||
|
if (typingNumber && key == ENTER) {
|
||||||
|
setTypedReso();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setTypedReso() {
|
||||||
|
typingNumber = false;
|
||||||
|
if (newResoString != "") {
|
||||||
|
renderSize = constrain(int(newResoString), 8, 15000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean keyIsNumber(int k) {
|
||||||
|
if (k == '0' ||k == '1' || k == '2' || k == '3' || k == '4' || k == '5' || k == '6' || k == '7' || k == '8' || k == '9') {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,10 +60,14 @@ class Shader {
|
|||||||
}
|
}
|
||||||
previousPos = pos;
|
previousPos = pos;
|
||||||
|
|
||||||
if (previousActive != gui.bricks.get(pos).active) {
|
try{
|
||||||
|
if (previousActive != gui.bricks.get(pos).active) { //fails if brick has not yet been loaded but shader has
|
||||||
paramChanged = true;
|
paramChanged = true;
|
||||||
}
|
}
|
||||||
previousActive = gui.bricks.get(pos).active;
|
previousActive = gui.bricks.get(pos).active;
|
||||||
|
} catch (Exception e){
|
||||||
|
println("Brick not yet loaded, couldn't catch active state");
|
||||||
|
}
|
||||||
|
|
||||||
if (!paramChanged) {
|
if (!paramChanged) {
|
||||||
if (imageChanged) paramChanged = true;
|
if (imageChanged) paramChanged = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user