Skip to content

Commit 5ed914d

Browse files
committed
mergefix
2 parents 5432aa5 + 175dda0 commit 5ed914d

File tree

126 files changed

+8693
-519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+8693
-519
lines changed

README.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
# JRubyArt-examples for JRubyArt-1.2.4+
2-
JRubyArt-examples
1+
# JRubyArt-examples for JRubyArt-1.3.0+
2+
Description
33
================
44

5-
Rakefiles amended to use `-r` in place of `run`
6-
7-
Many of the vanilla processing example sketches have been translated to ruby-processing, and they are mainly written as 'bare' sketches (ie not class wrapped) in keeping with the original processing. At runtime these sketches the get wrapped into a Sketch class. Should you prefer you can still write class wrapped sketches, these will work equally well with jruby_art. You should also checkout the [Nature of Code Examples in ruby][] and for the beginner [Learning Processing with Ruby][] for even more examples.
8-
Includes autorun Rakefiles:-
5+
Like the original `ruby-processing`, `JRubyArt` is like a DSL for vanilla `processing`, so sketches can be written as **bare** sketches (ie they do not require a **class** wrapper, JRubyArt does that for you as does vanilla processing cf [propane][propane]). Here you will find many of the processing example sketches have been translated to ruby as **bare** sketches) but you can add a **class** wrapper if that suits you. You should also checkout the [Nature of Code Examples in ruby][] and for the beginner [Learning Processing with Ruby][] for even more examples. Many sketch folders includes autorun Rakefiles, and some of these can be run from the root directory as a demo:-
96

107
1. in a console cd `k9_samples` directory
11-
2. and `rake` to run all the autorun examples (not all the examples)
12-
3. or eg `rake hype` to just run the hype library examples (depends on an installed hype library).
8+
2. and `rake` to run all the core examples (excludes gem examples etc)
9+
3. `rake hype` to just run the hype library examples (depends on an installed hype library).
10+
4. `rake wordcram` to just run the wordcram gem examples (depends on an installed ruby_wordcram gem).
11+
5. `rake pbox2d` to just run the pbox2d gem examples (depends on an installed gem).
1312

1413
### Partial Catalogue (for the lazy)
1514

1615
1. [Basic][]
1716

1817
1. [structure][]
19-
2. [objects][]
18+
2. [objects][]
2019
3. [arrays][]
2120
4. [input][]
2221
5. [shape][]
@@ -28,20 +27,30 @@ Includes autorun Rakefiles:-
2827
1. [shaders][]
2928
2. [lsystems][]
3029
3. [advanced data][]
31-
30+
3231
3. [Libraries][]
3332
1. [fastmath][]
3433
2. [vecmath][]
3534
3. [control-panel][]
3635
4. [video][]
3736

38-
4. [JBox2D][]
39-
5. [Hype-processing][hype]
40-
6. [Sunflow raytracing][joons]
37+
4. Gems
38+
1. [PBox2D][pbox2d]
39+
2. [Geomerative][geomerative]
40+
3. [Toxiclibs][toxiclibs]
41+
4. [Wordcram][wordcram]
42+
5. [Sunflow raytracing][joons]
43+
44+
5. Java Libraries
45+
1. [Hype-processing][hype]
46+
2. [Hemesh][hemesh]
47+
6. Others
48+
1. [WOVNS patterns][wovns]
4149

4250
### User contributions are most welcome
4351
[Contributions][] add your [own][]
4452

53+
[wovns]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/examples/WOVNS
4554
[Learning Processing with Ruby]:https://github.com/ruby-processing/learning-processing-with-ruby
4655
[Nature of Code Examples in ruby]:https://github.com/ruby-processing/The-Nature-of-Code-for-JRubyArt
4756
[Contributions]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/contributed
@@ -63,6 +72,11 @@ Includes autorun Rakefiles:-
6372
[vecmath]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/processing_app/library/vecmath
6473
[video]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/processing_app/library/video
6574
[control-panel]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/contributed/jwishy.rb
66-
[JBox2D]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/external_library/ruby_gem/jbox2d
75+
[PBox2D]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/external_library/ruby_gem/jbox2d
6776
[hype]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/external_library/java/hype
77+
[hemesh]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/external_library/java/hemesh
6878
[joons]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/external_library/gem/joonsrenderer
79+
[geomerative]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/external_library/gem/geomerative
80+
[toxiclibs]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/external_library/gem/toxiclibs
81+
[wordcram]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/external_library/gem/ruby_wordcram
82+
[propane]:https://ruby-processing.github.io/propane/

Rakefile

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,60 @@
11
# -*- encoding: utf-8 -*-
22

3-
root = File.expand_path(__dir__)
3+
K9WD = File.expand_path(__dir__)
44

5-
desc 'run contributed samples'
5+
desc 'run contributed samples'
66
task :default => [:all]
77

88
desc 'run all autorun samples except hype'
99
task :all do
1010
Rake::Task[:contributed].execute
11-
Rake::Task[:vecmath].execute
11+
Rake::Task[:vecmath].execute
1212
Rake::Task[:shaders].execute
1313
Rake::Task[:slider].execute
1414
end
1515

1616
desc 'run contributed samples'
1717
task :contributed do
18-
sh "cd #{root}/contributed && rake"
18+
sh "cd #{K9WD}/contributed && rake"
1919
end
2020

2121
desc 'shaders'
2222
task :shaders do
23-
sh "cd #{root}/processing_app/topics/shaders && rake"
23+
sh "cd #{K9WD}/processing_app/topics/shaders && rake"
2424
end
2525

2626
desc 'vecmath'
2727
task :vecmath do
28-
sh "cd #{root}/processing_app/library/vecmath/vec2d && rake"
29-
sh "cd #{root}/processing_app/library/vecmath/vec3d && rake"
30-
sh "cd #{root}/processing_app/library/vecmath/arcball && rake"
28+
sh "cd #{K9WD}/processing_app/library/vecmath/vec2d && rake"
29+
sh "cd #{K9WD}/processing_app/library/vecmath/vec3d && rake"
30+
sh "cd #{K9WD}/processing_app/library/vecmath/arcball && rake"
3131
end
3232

3333
desc 'hype'
3434
task :hype do
35-
sh "cd #{root}/external_library/java/hype && rake"
35+
sh "cd #{K9WD}/external_library/java/hype && rake"
3636
end
3737

3838
desc 'slider'
3939
task :slider do
40-
sh "cd #{root}/processing_app/library/slider && rake"
40+
sh "cd #{K9WD}/processing_app/library/slider && rake"
41+
end
42+
43+
desc 'hemesh'
44+
task :hemesh do
45+
sh "cd #{K9WD}/external_library/java/hemesh && rake"
46+
end
47+
48+
desc 'pbox2d'
49+
task :pbox2d do
50+
sh "cd #{K9WD}/external_library/gem/pbox2d && rake"
51+
sh "cd #{K9WD}/external_library/gem/pbox2d/revolute_joint && k9 -r revolute_joint.rb"
52+
sh "cd #{K9WD}/external_library/gem/pbox2d/test_contact && k9 -r test_contact.rb"
53+
sh "cd #{K9WD}/external_library/gem/pbox2d/mouse_joint && k9 -r mouse_joint.rb"
54+
sh "cd #{K9WD}/external_library/gem/pbox2d/distance_joint && k9 -r distance_joint.rb"
55+
end
56+
57+
desc 'wordcram'
58+
task :wordcram do
59+
sh "cd #{K9WD}/external_library/gem/ruby_wordcram && rake"
4160
end

contributed/25_squares.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# Vera Molnar – 25 Squares
44
# # # # #
55
# Interpretation by Martin Vögeli
6-
# Converted to propane Martin Prout
7-
# features the :grid convenience method
6+
# Converted to JRubyArt Martin Prout
87
# # # # #
98
# Based on code by Indae Hwang and Jon McCormack
109
def settings
@@ -25,10 +24,9 @@ def draw
2524
# calculate the size of each square for the given number of squares and gap between them
2625
cellsize = (width - (grid_size + 1) * gap) / grid_size
2726
position = -> (count) { gap * (count + 1) + cellsize * count + rand(-5..5) }
28-
grid(grid_size, grid_size) do |i, j| # the grid convenience method takes a block
29-
# Note how to create transparent fill with web color JRubyArt
27+
grid(grid_size, grid_size) do |x, y|
3028
rand(0..5) > 4 ? fill(color('#a11220'), 180.0) : fill(color('#884444'), 180.0)
31-
rect(position.call(i), position.call(j), cellsize, cellsize)
29+
rect(position.call(x), position.call(y), cellsize, cellsize)
3230
end
3331
# save your drawings when you press keyboard 's' continually
3432
save_frame('######.jpg') if key_pressed? && key == 's'

contributed/animator.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def setup
1313
@draw = false
1414
@back_color = 204
1515
stroke_weight 4
16-
smooth
1716
background @back_color
1817
FRAME_COUNT.times { @frames << get }
1918
end

contributed/full_screen.rb

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
# Description:
2-
# This is a full-screen demo
3-
# Since processing-3.0a10 set in settings
2+
# This is a full-screen demo
3+
# Using JRubyArt grid method
44

5-
class FullScreen < Processing::App
6-
def setup
7-
sketch_title 'Full Screen'
8-
no_stroke
9-
end
5+
GRID_SIZE = 100
6+
HALF = 50
107

11-
def draw
12-
lights
13-
background 0
14-
fill 120, 160, 220
15-
(width/100).times do |x|
16-
(height/100).times do |y|
17-
new_x, new_y = x * 100, y * 100
18-
push_matrix
19-
translate new_x + 50, new_y + 50
20-
rotate_y(((mouse_x.to_f + new_x) / width) * Math::PI)
21-
rotate_x(((mouse_y.to_f + new_y) / height) * Math::PI)
22-
box 90
23-
pop_matrix
24-
end
25-
end
26-
end
8+
def setup
9+
sketch_title 'Full Screen'
10+
no_stroke
11+
end
2712

28-
def settings
29-
full_screen P3D
13+
def draw
14+
lights
15+
background 0
16+
fill 120, 160, 220
17+
grid(width, height, GRID_SIZE, GRID_SIZE) do |x, y|
18+
push_matrix
19+
translate x + HALF, y + GRID_SIZE
20+
rotate_y(((mouse_x.to_f + x) / width) * Math::PI)
21+
rotate_x(((mouse_y.to_f + y) / height) * Math::PI)
22+
box 90
23+
pop_matrix
3024
end
3125
end
3226

27+
def settings
28+
full_screen(P3D)
29+
end

contributed/getting_started.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def setup
1111

1212
def draw
1313
fill 0, 20
14-
rect 0, 0, width, height
14+
rect 0, 0, width, height
1515
translate width / 2, height / 2
1616
rotate rotation
1717
fill 255
@@ -21,5 +21,4 @@ def draw
2121

2222
def settings
2323
size 200, 200
24-
smooth
2524
end

contributed/jwishy.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def setup
3636
@back_color = [0.06, 0.03, 0.18]
3737
color_mode RGB, 1
3838
ellipse_mode CORNER
39-
smooth
4039
end
4140

4241
def draw_background

contributed/orbit.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@ def draw
3535

3636
def settings
3737
size 450, 450
38-
smooth
3938
end

contributed/plain.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ def draw
1616
background 0
1717
fill 120, 160, 220
1818
stroke 0
19-
rect_mode(CENTER)
20-
(dim..width - dim).step(dim) do |x|
21-
(dim..height - dim).step(dim) do |y|
22-
rect x, y, dim, dim, rnd, rnd, rnd, rnd
23-
end
19+
#rect_mode(CENTER)
20+
# (dim..width - dim).step(dim) do |x|
21+
# (dim..height - dim).step(dim) do |y|
22+
# rect x, y, dim, dim, rnd, rnd, rnd, rnd
23+
# end
24+
# end
25+
grid(width, height, dim, dim) do |x, y|
26+
rect x, y, dim, dim, rnd, rnd, rnd, rnd
2427
end
2528
end
2629

contributed/tree.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,4 @@ def branch(h)
6666

6767
def settings
6868
size 200, 200
69-
smooth
7069
end

0 commit comments

Comments
 (0)