Skip to content

Commit 44a8af2

Browse files
authored
Update frameRate (#216)
* reference: Rename frameRate Signed-off-by: Ce Gao <[email protected]> * RLang: Add frame rate var Signed-off-by: Ce Gao <[email protected]>
1 parent de0a844 commit 44a8af2

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
category: Environment
2+
subcategory:
3+
description: "
4+
The system variable <b>frameRateVar</b> contains the approximate frame rate of a running sketch. The initial value is 10 fps and is updated with each frame. The value is averaged over several frames, and so will only be accurate after the draw function has run 5-10 times.
5+
"
6+
syntax: ""
7+
related:
8+
- frameRate

examples/reference/frameRate_var/.property.yml

-8
This file was deleted.

src/rprocessing/RLangPApplet.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public void setup() {
329329
@Override
330330
public void handleDraw() {
331331
super.handleDraw();
332-
this.renjinEngine.put("frameCount", this.frameCount);
332+
this.wrapFrameVariables();
333333
}
334334

335335
/**
@@ -368,6 +368,11 @@ private boolean isMixMode() {
368368
return hasSize;
369369
}
370370

371+
protected void wrapFrameVariables() {
372+
this.renjinEngine.put("frameRateVar", frameRate);
373+
this.renjinEngine.put("frameCount", frameCount);
374+
}
375+
371376
/**
372377
* Set Environment variables in R top context.
373378
*/

0 commit comments

Comments
 (0)