Skip to content

Commit fc4346e

Browse files
committed
more autorun
1 parent 3030ac9 commit fc4346e

10 files changed

Lines changed: 141 additions & 17 deletions

File tree

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
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Simple demo Rakefile to autorun samples in current directory
2+
# adjust path to rp5 executable, and or opts as required
3+
4+
SAMPLES_DIR = './'
5+
6+
desc 'run demo'
7+
task default: [:demo]
8+
9+
desc 'demo'
10+
task :demo do
11+
samples_list.shuffle.each { |sample| run_sample sample }
12+
end
13+
14+
def samples_list
15+
files = []
16+
Dir.chdir(SAMPLES_DIR)
17+
Dir.glob('*.rb').each do |file|
18+
files << File.join(SAMPLES_DIR, file)
19+
end
20+
return files
21+
end
22+
23+
def run_sample(sample_name)
24+
puts "Running #{sample_name}...quit to run next sample"
25+
open("|k9 -r #{sample_name}", 'r') do |io|
26+
while l = io.gets
27+
puts(l.chop)
28+
end
29+
end
30+
end

external_library/gem/pbox2d/distance_joint/boundary.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Daniel Shiffman
33
# http://natureofcode.com
44

5+
CENTER ||= Java::ProcessingCore::PConstants::CENTER
6+
57
# A fixed boundary class
68
class Boundary
79
extend Forwardable
@@ -32,7 +34,7 @@ def initialize(x, y, w, h)
3234
def display
3335
fill(0)
3436
stroke(0)
35-
rect_mode(Java::ProcessingCore::CENTER)
37+
rect_mode(CENTER)
3638
rect(x, y, w, h)
3739
end
3840
end

external_library/gem/pbox2d/distance_joint/distance_joint.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414

1515
attr_reader :box2d, :boundaries, :system
1616

17-
def setup
17+
def settings
1818
size(640, 360)
19-
sketch_title 'Distance Joint'
19+
end
20+
21+
def setup
22+
sketch_title 'Distance Joint'
2023
# Initialize box2d physics and create the world
2124
@box2d = WorldBuilder.build(app: self)
2225
@system = ParticleSystem.new

external_library/gem/pbox2d/revolute_joint/box.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# http://natureofcode.com
44
require 'forwardable'
55

6+
CENTER ||= Java::ProcessingCore::PConstants::CENTER
7+
68
# A rectangular box
79
class Box
810
extend Forwardable
@@ -55,7 +57,7 @@ def display
5557
# Get its angle of rotation
5658
a = body.getAngle
5759

58-
rect_mode(Java::ProcessingCore::CENTER)
60+
rect_mode(CENTER)
5961
push_matrix
6062
translate(pos.x,pos.y)
6163
rotate(-a)

external_library/gem/pbox2d/revolute_joint/revolute_joint.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010

1111
attr_reader :box2d, :windmill, :system
1212

13+
def settings
14+
size(640, 360)
15+
end
16+
1317
def setup
14-
size(640,360)
18+
sketch_title 'Revolute Joint'
1519
@box2d = WorldBuilder.build(app: self)
1620
@windmill = Windmill.new(width / 2, 175)
1721
@system = ParticleSystem.new

external_library/gem/pbox2d/test_contact/lib/boundary.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'forwardable'
22

3-
CENTER ||= Java::ProcessingCore::CENTER
3+
CENTER ||= Java::ProcessingCore::PConstants::CENTER
44
# The boundary class is used to create a floor in this
55
# sketch. Note it does not have a change method
66
class Boundary

external_library/gem/pbox2d/test_contact/test_contact.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66

77
attr_reader :box2d, :particles, :wall
88

9-
def setup
9+
def settings
1010
size 400, 400
11+
end
12+
13+
def setup
14+
sketch_title 'Test Contact'
1115
@box2d = WorldBuilder.build(app: self)
1216
box2d.add_listener(CustomListener.new)
1317
@particles = []
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Simple demo Rakefile to autorun samples in current directory
2+
# adjust path to rp5 executable, and or opts as required
3+
4+
SAMPLES_DIR = './'
5+
6+
desc 'run demo'
7+
task default: [:demo]
8+
9+
desc 'demo'
10+
task :demo do
11+
samples_list.shuffle.each { |sample| run_sample sample }
12+
end
13+
14+
def samples_list
15+
files = []
16+
Dir.chdir(SAMPLES_DIR)
17+
Dir.glob('*.rb').each do |file|
18+
files << File.join(SAMPLES_DIR, file)
19+
end
20+
return files
21+
end
22+
23+
def run_sample(sample_name)
24+
puts "Running #{sample_name}...quit to run next sample"
25+
open("|k9 -r #{sample_name}", 'r') do |io|
26+
while l = io.gets
27+
puts(l.chop)
28+
end
29+
end
30+
end
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Simple demo Rakefile to autorun samples in current directory
2+
# adjust path to rp5 executable, and or opts as required
3+
4+
SAMPLES_DIR = './'
5+
6+
desc 'run demo'
7+
task default: [:demo]
8+
9+
desc 'demo'
10+
task :demo do
11+
samples_list.shuffle.each { |sample| run_sample sample }
12+
end
13+
14+
def samples_list
15+
files = []
16+
Dir.chdir(SAMPLES_DIR)
17+
Dir.glob('*.rb').each do |file|
18+
files << File.join(SAMPLES_DIR, file)
19+
end
20+
return files
21+
end
22+
23+
def run_sample(sample_name)
24+
puts "Running #{sample_name}...quit to run next sample"
25+
open("|k9 -r #{sample_name}", 'r') do |io|
26+
while l = io.gets
27+
puts(l.chop)
28+
end
29+
end
30+
end

0 commit comments

Comments
 (0)