Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update frameRate #216

Merged
merged 2 commits into from
Aug 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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