From 9f18af3a1eb681992c07e6230d0ebab5a4d6efb0 Mon Sep 17 00:00:00 2001 From: Ce Gao Date: Tue, 11 Jul 2017 10:01:34 +0800 Subject: [PATCH 1/3] RLangMode: Add reference and library example Signed-off-by: Ce Gao --- examples/Libraries/Basics/Basics.rpde | 23 +++++++++++++++++++++++ src/rprocessing/mode/RLangMode.java | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 examples/Libraries/Basics/Basics.rpde diff --git a/examples/Libraries/Basics/Basics.rpde b/examples/Libraries/Basics/Basics.rpde new file mode 100644 index 0000000..038d03e --- /dev/null +++ b/examples/Libraries/Basics/Basics.rpde @@ -0,0 +1,23 @@ +settings <- function() { + importLibrary("peasycam") + size(200, 200, P3D) +} + +setup <- function() { + cam = PeasyCam$new(processing, 100) + cam$setMinimumDistance(50) + cam$setMaximumDistance(500) +} + +draw <- function() { + rotateX(-.5) + rotateY(-.5) + background(0) + fill(255, 0, 0) + box(30) + pushMatrix() + translate(0, 0, 20) + fill(0, 0, 255) + box(5) + popMatrix() +} diff --git a/src/rprocessing/mode/RLangMode.java b/src/rprocessing/mode/RLangMode.java index 977e90d..4e8260d 100644 --- a/src/rprocessing/mode/RLangMode.java +++ b/src/rprocessing/mode/RLangMode.java @@ -100,7 +100,8 @@ public String[] getExtensions() { */ @Override public File[] getExampleCategoryFolders() { - return new File[] {new File(examplesFolder, "Basics")}; + return new File[] {new File(examplesFolder, "Basics"), new File(examplesFolder, "Libraries"), + new File(examplesFolder, "reference")}; } /** From c9bf133e0dcb2807236b61f8a229615c11cba2c0 Mon Sep 17 00:00:00 2001 From: Ce Gao Date: Tue, 11 Jul 2017 10:11:06 +0800 Subject: [PATCH 2/3] reference: Add importLibrary doc Signed-off-by: Ce Gao --- .../reference/importLibrary/.property.yml | 9 ++++++++ .../importLibrary0/importLibrary0.rpde | 23 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 examples/reference/importLibrary/.property.yml create mode 100644 examples/reference/importLibrary/importLibrary0/importLibrary0.rpde diff --git a/examples/reference/importLibrary/.property.yml b/examples/reference/importLibrary/.property.yml new file mode 100644 index 0000000..e723b44 --- /dev/null +++ b/examples/reference/importLibrary/.property.yml @@ -0,0 +1,9 @@ +category: Library +subcategory: +description: " +Import Processing libraries. +" +syntax: " importLibrary(library)" +parameters: + - label: 'library' + description: "The name of the library." diff --git a/examples/reference/importLibrary/importLibrary0/importLibrary0.rpde b/examples/reference/importLibrary/importLibrary0/importLibrary0.rpde new file mode 100644 index 0000000..038d03e --- /dev/null +++ b/examples/reference/importLibrary/importLibrary0/importLibrary0.rpde @@ -0,0 +1,23 @@ +settings <- function() { + importLibrary("peasycam") + size(200, 200, P3D) +} + +setup <- function() { + cam = PeasyCam$new(processing, 100) + cam$setMinimumDistance(50) + cam$setMaximumDistance(500) +} + +draw <- function() { + rotateX(-.5) + rotateY(-.5) + background(0) + fill(255, 0, 0) + box(30) + pushMatrix() + translate(0, 0, 20) + fill(0, 0, 255) + box(5) + popMatrix() +} From 4f2e8eeeaf0c4831fad86161c41dfb7f7986149e Mon Sep 17 00:00:00 2001 From: Ce Gao Date: Tue, 11 Jul 2017 10:25:46 +0800 Subject: [PATCH 3/3] reference: Fix coding style issues Signed-off-by: Ce Gao --- examples/Libraries/Basics/Basics.rpde | 4 ++-- .../importLibrary/importLibrary0/importLibrary0.rpde | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/Libraries/Basics/Basics.rpde b/examples/Libraries/Basics/Basics.rpde index 038d03e..7f8ecc0 100644 --- a/examples/Libraries/Basics/Basics.rpde +++ b/examples/Libraries/Basics/Basics.rpde @@ -10,8 +10,8 @@ setup <- function() { } draw <- function() { - rotateX(-.5) - rotateY(-.5) + rotateX(-0.5) + rotateY(-0.5) background(0) fill(255, 0, 0) box(30) diff --git a/examples/reference/importLibrary/importLibrary0/importLibrary0.rpde b/examples/reference/importLibrary/importLibrary0/importLibrary0.rpde index 038d03e..7f8ecc0 100644 --- a/examples/reference/importLibrary/importLibrary0/importLibrary0.rpde +++ b/examples/reference/importLibrary/importLibrary0/importLibrary0.rpde @@ -10,8 +10,8 @@ setup <- function() { } draw <- function() { - rotateX(-.5) - rotateY(-.5) + rotateX(-0.5) + rotateY(-0.5) background(0) fill(255, 0, 0) box(30)