/**
* +-+-+-+-+-+ +-+-+-+-+-+
* / /| |\ \
- * / / + <+ \ \
+ * / / + + \ \
* +-+-+-+-+-+ | +-+-+-+-+ | +-+-+-+-+-+
* | | + / \ + | |
* + THE + / / \ \ + CUBES +
final int VIEWPORT_WIDTH = 900;
final int VIEWPORT_HEIGHT = 700;
-final int TARGET_FRAMERATE = 45;
+
+int targetFramerate = 30;
int startMillis, lastMillis;
GLucose glucose;
// Initialize the Processing graphics environment
size(VIEWPORT_WIDTH, VIEWPORT_HEIGHT, OPENGL);
- frameRate(TARGET_FRAMERATE);
+ frameRate(targetFramerate);
noSmooth();
// hint(ENABLE_OPENGL_4X_SMOOTH); // no discernable improvement?
logTime("Created viewport");
mappingTool.keyPressed();
}
switch (key) {
+ case '-':
+ case '_':
+ frameRate(--targetFramerate);
+ break;
+ case '=':
+ case '+':
+ frameRate(++targetFramerate);
+ break;
case 'd':
debugMode = !debugMode;
println("Debug output: " + (debugMode ? "ON" : "OFF"));
textFont(titleFont);
textAlign(LEFT);
fill(#666666);
- text("FPS: " + (((int)(frameRate * 10)) / 10.), 4, height-6);
+ text("FPS: " + (((int)(frameRate * 10)) / 10.), 4, height-6);
+ text("Target (-/+):", 50, height-6);
+ fill(#000000);
+ rect(104, height-16, 20, 12);
+ fill(#666666);
+ text("" + targetFramerate, 108, height-6);
}
protected int drawObjectList(int yPos, String title, Object[] items, Method stateMethod) {
return (mouseY - firstItemY) / lineHeight;
}
- abstract public void draw();
+ abstract public void draw();
abstract public void mousePressed();
abstract public void mouseDragged();
abstract public void mouseReleased();