Skip to content

Commit

Permalink
Update frameRate (#216)
Browse files Browse the repository at this point in the history
* reference: Rename frameRate

Signed-off-by: Ce Gao <[email protected]>

* RLang: Add frame rate var

Signed-off-by: Ce Gao <[email protected]>
  • Loading branch information
gaocegege authored Aug 20, 2017
1 parent de0a844 commit 44a8af2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
8 changes: 8 additions & 0 deletions examples/reference/frameRateVar/.property.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
category: Environment
subcategory:
description: "
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.
"
syntax: ""
related:
- frameRate
8 changes: 0 additions & 8 deletions examples/reference/frameRate_var/.property.yml

This file was deleted.

7 changes: 6 additions & 1 deletion src/rprocessing/RLangPApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public void setup() {
@Override
public void handleDraw() {
super.handleDraw();
this.renjinEngine.put("frameCount", this.frameCount);
this.wrapFrameVariables();
}

/**
Expand Down Expand Up @@ -368,6 +368,11 @@ private boolean isMixMode() {
return hasSize;
}

protected void wrapFrameVariables() {
this.renjinEngine.put("frameRateVar", frameRate);
this.renjinEngine.put("frameCount", frameCount);
}

/**
* Set Environment variables in R top context.
*/
Expand Down

0 comments on commit 44a8af2

Please sign in to comment.