|
|
@@ -14,13 +14,13 @@ public class SecondApplet extends PApplet { |
|
|
|
ArrayList<Brick> bricks = new ArrayList<Brick>(); |
|
|
|
ArrayList<Slider> slider = new ArrayList<Slider>(); //brick |
|
|
|
int binX, binY, binS; |
|
|
|
|
|
|
|
|
|
|
|
//PApplet parent; |
|
|
|
/*SecondApplet(PApplet _parent){ |
|
|
|
super(); |
|
|
|
this.parent = _parent; |
|
|
|
}*/ |
|
|
|
|
|
|
|
super(); |
|
|
|
this.parent = _parent; |
|
|
|
}*/ |
|
|
|
|
|
|
|
public void settings() { |
|
|
|
size(275, 120); |
|
|
|
} |
|
|
@@ -134,7 +134,6 @@ public class SecondApplet extends PApplet { |
|
|
|
int totalBrickHeight; |
|
|
|
public void draw() { |
|
|
|
|
|
|
|
|
|
|
|
background(68, 68, 68); |
|
|
|
pushMatrix(); |
|
|
|
if (heightOverLimit) { |
|
|
@@ -163,6 +162,15 @@ public class SecondApplet extends PApplet { |
|
|
|
textSize(25); |
|
|
|
fill(255); |
|
|
|
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); |
|
|
|
line(0, height-120, width, height-120); |
|
|
|
|
|
|
@@ -271,19 +279,19 @@ public class SecondApplet extends PApplet { |
|
|
|
previousRenderSize = renderSize; |
|
|
|
else |
|
|
|
renderSizeChanged = false; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < shaderList.size(); i++) { |
|
|
|
//try { |
|
|
|
try { |
|
|
|
|
|
|
|
shaderList.get(i).getValuesFromGUI(); |
|
|
|
if (bricks.get(i).active) { |
|
|
|
//shaderList.get(i).getValuesFromGUI(); |
|
|
|
shaderList.get(i).shade(); |
|
|
|
} |
|
|
|
//} |
|
|
|
//catch(Exception e) { |
|
|
|
// println("Warning: Brick not yet loaded"); |
|
|
|
//} |
|
|
|
} |
|
|
|
catch(Exception e) { |
|
|
|
println("Warning: Brick not yet loaded"); |
|
|
|
} |
|
|
|
if (i > maxFx) break; |
|
|
|
} |
|
|
|
} |
|
|
@@ -613,7 +621,7 @@ public class SecondApplet extends PApplet { |
|
|
|
Class<?> shaderChildClass = null; |
|
|
|
Shader s = null; |
|
|
|
try { |
|
|
|
shaderChildClass = Class.forName(sketchClass.getName() + "$" + name); |
|
|
|
shaderChildClass = Class.forName(sketchClass.getName() + "$" + name); |
|
|
|
s = (Shader) shaderChildClass.getDeclaredConstructor(sketchClass).newInstance(mainApplet); |
|
|
|
shaderManager.addShader(s); |
|
|
|
} |
|
|
@@ -710,4 +718,35 @@ public class SecondApplet extends PApplet { |
|
|
|
} |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
} |