Skip to content

Commit 063fcfc

Browse files
committed
update
1 parent d951e6f commit 063fcfc

16 files changed

+89
-64
lines changed

.travis.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
1-
sudo: false
2-
31
language: ruby
4-
5-
bundler_args: --without production
6-
2+
sudo: false
73
addons:
84
apt:
95
packages:
10-
- oracle-java8-installer
6+
-oracle-java8-installer
117

128
rvm:
13-
- jruby-head
14-
9+
- jruby-9.0.5.0
1510
jdk:
1611
- oraclejdk8
17-
18-
env:
19-
- JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION"
20-
21-
before_script:
22-
- export JRUBY_OPTS="-Xcext.enabled=false -Xcompile.invokedynamic=false"
12+
os:
13+
- linux
2314

examples/Rakefile

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) unless file.end_with? 'agent.rb'
19+
end
20+
files
21+
end
22+
23+
def run_sample(sample_name)
24+
puts "Running #{sample_name}...quit to run next sample"
25+
open("|k9 run #{sample_name}", 'r') do |io|
26+
while l = io.gets
27+
puts(l.chop)
28+
end
29+
end
30+
end

examples/f_agent.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: utf-8
2+
# frozen_literal: true
13
# FontAgent class handles motion and display
24
class FontAgent
35
include Processing::Proxy # gives java 'inner class like' access to App
@@ -18,7 +20,7 @@ def display(xr:, yr:, m_point:)
1820
no_stroke
1921
fill(255, 73)
2022
dia = (150 / m_point) * 5
21-
# to get weird non-deterministic behaviour of original, created by use of
23+
# to get weird non-deterministic behaviour of original, created by use of
2224
# negative inputs to a random range surely not intended, use original:-
2325
# ellipse(loc.x + random(-xr, xr), loc.y + random(-yr, yr), dia, dia)
2426
xr *= -1 if xr < 0 # guards against an invalid hi..low range

examples/font_agent.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# encoding: utf-8
2+
# frozen_literal: true
3+
# FontAgent class handles motion and display
14
class FontAgent
25
include Processing::Proxy
36
attr_reader :loc, :mot

examples/hello_polygonize.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def settings
1313
def setup
1414
sketch_title 'polygonize'
1515
RG.init(self)
16-
shp = RG.load_shape('lion.svg')
16+
shp = RG.load_shape(data_path('lion.svg'))
1717
@shp = RG.center_in(shp, g, 100)
1818
end
1919

examples/hello_svg_to_pdf.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ def settings
1111
def setup
1212
sketch_title 'SVG to PDF sketch'
1313
RG.init(self)
14-
@grp = RG.load_shape('bot1.svg')
14+
@grp = RG.load_shape(data_path('bot1.svg'))
1515
@pdf = create_graphics(width, height, PDF, 'bot1.pdf')
1616
end
1717

1818
def draw
1919
background(255)
2020
grp.draw
21-
pdf.begin_draw
21+
pdf.begin_draw
2222
pdf.background(255)
2323
grp.draw(pdf)
2424
pdf.dispose

examples/hello_world.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def setup
1313
background(255)
1414
fill(255, 102, 0)
1515
stroke(0)
16-
@grp = RG.getText('Hola Mundo!', 'FreeSans.ttf', 72, CENTER)
16+
@grp = RG.getText('Hola Mundo!', data_path('FreeSans.ttf'), 72, CENTER)
1717
end
1818

1919
def draw

examples/jruby_merge.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#######################/
1+
#######################
22
# --------- GEOMERATIVE EXAMPLES ---------------
33
#######################
44
# Title : TypoGeo_Merge
@@ -28,24 +28,24 @@
2828

2929
attr_reader :my_font, :stop, :xoff, :yoff, :x_inc, :y_inc
3030

31-
TEXT = %w{RubyArt Processing}
31+
TEXT = %w(RubyArt Processing).freeze
3232

3333
def settings
3434
size(960, 640)
3535
end
3636

3737
def setup
38-
sketch_title TEXT.join ' '
38+
sketch_title TEXT.join ' '
3939
RG.init(self)
40-
@my_font = RFont.new('FreeSans.ttf', 200, CENTER)
40+
@my_font = RFont.new(data_path('FreeSans.ttf'), 200, CENTER)
4141
@stop = false
4242
no_fill
4343
stroke(255)
4444
stroke_weight(0.5)
4545
rect_mode(CENTER)
4646
@xoff = 0.0
4747
@yoff = 0.0
48-
@x_inc= 0.01
48+
@x_inc = 0.01
4949
@y_inc = 0.015
5050
end
5151

@@ -60,7 +60,7 @@ def draw
6060
RCommand.set_segment_length(frequency)
6161
my_points = my_font.to_group(TEXT[0]).get_points
6262
begin_shape
63-
my_points.each do |point|
63+
my_points.each do |point|
6464
vertex(point.x, point.y)
6565
rotation = map1d(displace_y, (0..height), (0..TWO_PI))
6666
push_matrix
@@ -89,6 +89,6 @@ def key_pressed
8989
@stop = !stop
9090
stop ? no_loop : loop
9191
when 's', 'S'
92-
save_frame('000_###.png')
92+
save_frame(data_path('000_###.png'))
9393
end
9494
end

examples/physics_type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def setup
1212
sketch_title 'Physics Type'
1313
@input = 'Hello!'
1414
RG.init(self)
15-
fnt = RG.load_font('ReplicaBold.ttf') # file name
15+
fnt = RG.load_font(data_path('ReplicaBold.ttf')) # file name
1616
RG.text_font(fnt, 330) # RFont object, size
1717
@font = RG.get_text(input) # String to RShape
1818
RG.set_polygonizer(RCommand::UNIFORMLENGTH)

examples/rotate_first_letter.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require 'geomerative'
22

3-
# Declare the objects we are going to use, so that they are accesible from setup() and from draw()
3+
# Declare the objects we are going to use, so that they are accesible from setup
4+
# and from draw
45
attr_reader :grp
56

67
def settings
@@ -15,7 +16,7 @@ def setup
1516
background(255)
1617
fill(255, 102, 0)
1718
stroke(0)
18-
@grp = RG.getText('Hola Mundo!', 'FreeSans.ttf', 72, CENTER)
19+
@grp = RG.getText('Hola Mundo!', data_path('FreeSans.ttf'), 72, CENTER)
1920
end
2021

2122
def draw
@@ -24,5 +25,3 @@ def draw
2425
grp.children[0].rotate(PI / 20, grp.children[0].get_center)
2526
grp.draw
2627
end
27-
28-

0 commit comments

Comments
 (0)