framerate to frameRate, some todo stuff, addl font docs

This commit is contained in:
benfry
2006-07-29 03:34:56 +00:00
parent 7cf1fa6f06
commit 48218e42c2
4 changed files with 46 additions and 30 deletions

View File

@@ -301,12 +301,12 @@ public class PApplet extends Applet
* but is instead averaged (integrated) over several frames.
* As such, this value won't be valid until after 5-10 frames.
*/
public float framerate = 10;
protected long framerateLastMillis = 0;
public float frameRate = 10;
protected long frameRateLastMillis = 0;
// setting the frame rate
protected long framerateLastDelayTime = 0;
protected float framerateTarget = 0;
protected long frameRateLastDelayTime = 0;
protected float frameRateTarget = 0;
protected boolean looping;
@@ -729,9 +729,9 @@ public class PApplet extends Applet
if (looping) {
looping = false;
// reset framerate delay times
framerateLastDelayTime = 0;
framerateLastMillis = 0;
// reset frameRate delay times
frameRateLastDelayTime = 0;
frameRateLastMillis = 0;
if (thread != null) {
if (CRUSTY_THREADS) {
@@ -1101,7 +1101,7 @@ public class PApplet extends Applet
// g.image is synchronized so that draw/loop and paint don't
// try to fight over it. this was causing a randomized slowdown
// that would cut the framerate into a third on macosx,
// that would cut the frameRate into a third on macosx,
// and is probably related to the windows sluggishness bug too
if (THREAD_DEBUG) println(Thread.currentThread().getName() +
" 5b enter paint sync");
@@ -1301,33 +1301,33 @@ public class PApplet extends Applet
this.defaultSize = false;
} else { // frameCount > 0, meaning an actual draw()
// update the current framerate
if (framerateLastMillis != 0) {
// update the current frameRate
if (frameRateLastMillis != 0) {
float elapsed = (float)
(System.currentTimeMillis() - framerateLastMillis);
(System.currentTimeMillis() - frameRateLastMillis);
if (elapsed != 0) {
framerate =
(framerate * 0.9f) + ((1.0f / (elapsed / 1000.0f)) * 0.1f);
frameRate =
(frameRate * 0.9f) + ((1.0f / (elapsed / 1000.0f)) * 0.1f);
}
}
framerateLastMillis = System.currentTimeMillis();
frameRateLastMillis = System.currentTimeMillis();
if (framerateTarget != 0) {
if (frameRateTarget != 0) {
//System.out.println("delaying");
if (framerateLastDelayTime == 0) {
framerateLastDelayTime = System.currentTimeMillis();
if (frameRateLastDelayTime == 0) {
frameRateLastDelayTime = System.currentTimeMillis();
} else {
long timeToLeave =
framerateLastDelayTime + (long)(1000.0f / framerateTarget);
frameRateLastDelayTime + (long)(1000.0f / frameRateTarget);
long now = System.currentTimeMillis();
int napTime = (int) (timeToLeave - now);
if (napTime > 0) {
framerateLastDelayTime = timeToLeave;
frameRateLastDelayTime = timeToLeave;
delay(napTime);
} else {
// nap time is negative, need to reset clock (bug #336)
framerateLastDelayTime = now;
frameRateLastDelayTime = now;
}
}
}
@@ -1917,11 +1917,15 @@ public class PApplet extends Applet
/**
* Set a target framerate. This will cause delay() to be called
* after each frame to allow for a specific rate to be set.
* Set a target frameRate. This will cause delay() to be called
* after each frame so that the sketch synchronizes to a particular speed.
* Note that this only sets the maximum frame rate, it cannot be used to
* make a slow sketch go faster. Sketches have no default frame rate
* setting, and will attempt to use maximum processor power to achieve
* maximum speed.
*/
public void framerate(float framerateTarget) {
this.framerateTarget = framerateTarget;
public void frameRate(float frameRateTarget) {
this.frameRateTarget = frameRateTarget;
}

View File

@@ -622,11 +622,10 @@ public class PFont implements PConstants {
/**
* The default Processing character set.
* <P>
* This is the union of the Mac Roman and Windows ANSI
* character sets. ISO Latin 1 would be Unicode characters
* 0x80 -> 0xFF, but in practice, it would seem that most
* designers using P5 would rather have the characters
* that they expect from their platform's fonts.
* This is the union of the Mac Roman and Windows ANSI (CP1250)
* character sets. ISO 8859-1 Latin 1 is Unicode characters 0x80 -> 0xFF,
* and would seem a good standard, but in practice, most P5 users would
* rather have characters that they expect from their platform's fonts.
* <P>
* This is more of an interim solution until a much better
* font solution can be determined. (i.e. create fonts on

View File

@@ -24,6 +24,7 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=359
X update jogl to latest beta 5
_ might fix blank screen issues on linux:
_ http://dev.processing.org/bugs/show_bug.cgi?id=367
X make framerate into frameRate (to match frameCount)
fixed in 0115 / quicktime 7.1
X color values on camera input flipped on intel macs
@@ -38,6 +39,13 @@ o right now the camera doesn't get set up unless you call depth()
o box and sphere are broken in gl
o what should the update image function be called?
_ color(0, 0, 0, 0) produces black
_ although fill(0, 0, 0, 0) does the right thing
_ also, rgb255 not getting set
_ http://dev.processing.org/bugs/show_bug.cgi?id=382
_ revision 115 may be saving raw files as TIFF format
_ http://dev.processing.org/bugs/show_bug.cgi?id=378
things before 1.0
_ know internal vs. external lines, so that anti-aliasing can be shut off for internal
@@ -64,7 +72,6 @@ _ even though it seems to be ok for a component
_ AIOOBE in P3D during defaults/background/clear
_ thread sync problem with allocation
_ make framerate into frameRate (to match frameCount)
_ remove image(filename) and textFont(filename) et al.
_ hint(DISABLE_NATIVE_FONTS) to disable the built-in stuff?

View File

@@ -39,6 +39,9 @@ X make the instructions for winvdig clearer
X be sure to say "yes to all" when deinstalling winvdig
X install 1.0.1 not 1.0.5
X 1.0.5 doesn't seem to be necessary, and can't resize windows
_ use capture events when doing computation, use available() when drawing
_ there are threading issues with reading video and its pixels
_ these particularly show up on slower machines
faq / troubleshooting
X a method called run() with no params will cause trouble
@@ -428,6 +431,9 @@ _ add a better handler for this specific thing?
_ http://dev.processing.org/bugs/show_bug.cgi?id=18
_ using a keyword as a variable name gives unhelpful error message
_ http://dev.processing.org/bugs/show_bug.cgi?id=212
_ unspecified return type creates compile error
_ or maybe not? followup said maybe not
_ http://dev.processing.org/bugs/show_bug.cgi?id=379
hacked for fix, needs real fix
_ NullPointerException on unterminated comment at end of code