Skip to content

Commit 9ef02a2

Browse files
authored
Add reference and library example (#150)
* RLangMode: Add reference and library example Signed-off-by: Ce Gao <[email protected]> * reference: Add importLibrary doc Signed-off-by: Ce Gao <[email protected]> * reference: Fix coding style issues Signed-off-by: Ce Gao <[email protected]>
1 parent aed8ba6 commit 9ef02a2

File tree

4 files changed

+57
-1
lines changed

4 files changed

+57
-1
lines changed

examples/Libraries/Basics/Basics.rpde

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
settings <- function() {
2+
importLibrary("peasycam")
3+
size(200, 200, P3D)
4+
}
5+
6+
setup <- function() {
7+
cam = PeasyCam$new(processing, 100)
8+
cam$setMinimumDistance(50)
9+
cam$setMaximumDistance(500)
10+
}
11+
12+
draw <- function() {
13+
rotateX(-0.5)
14+
rotateY(-0.5)
15+
background(0)
16+
fill(255, 0, 0)
17+
box(30)
18+
pushMatrix()
19+
translate(0, 0, 20)
20+
fill(0, 0, 255)
21+
box(5)
22+
popMatrix()
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
category: Library
2+
subcategory:
3+
description: "
4+
Import Processing libraries.
5+
"
6+
syntax: " importLibrary(<c>library</c>)"
7+
parameters:
8+
- label: 'library'
9+
description: "The name of the library."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
settings <- function() {
2+
importLibrary("peasycam")
3+
size(200, 200, P3D)
4+
}
5+
6+
setup <- function() {
7+
cam = PeasyCam$new(processing, 100)
8+
cam$setMinimumDistance(50)
9+
cam$setMaximumDistance(500)
10+
}
11+
12+
draw <- function() {
13+
rotateX(-0.5)
14+
rotateY(-0.5)
15+
background(0)
16+
fill(255, 0, 0)
17+
box(30)
18+
pushMatrix()
19+
translate(0, 0, 20)
20+
fill(0, 0, 255)
21+
box(5)
22+
popMatrix()
23+
}

src/rprocessing/mode/RLangMode.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ public String[] getExtensions() {
100100
*/
101101
@Override
102102
public File[] getExampleCategoryFolders() {
103-
return new File[] {new File(examplesFolder, "Basics")};
103+
return new File[] {new File(examplesFolder, "Basics"), new File(examplesFolder, "Libraries"),
104+
new File(examplesFolder, "reference")};
104105
}
105106

106107
/**

0 commit comments

Comments
 (0)