Skip to content

Commit 27d2913

Browse files
committed
v simple example
1 parent 911b0ce commit 27d2913

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This class demonstrates how by inheriting from the abstract class LibraryProxy
2+
# we can access 'pre', 'draw' and 'post' (Note we need a draw method even
3+
# though it can be empty)
4+
class MyLibrary < LibraryProxy
5+
attr_reader :app
6+
7+
def initialize(parent)
8+
@app = parent
9+
end
10+
11+
def pre
12+
background(100) # just for demo
13+
end
14+
15+
def draw
16+
app.fill(200, 100)
17+
app.ellipse(150, 100, 200, 60)
18+
end
19+
end
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env jruby
2+
require 'propane'
3+
4+
class LibraryProxySketch < Propane::App
5+
6+
# A simple demonstration of vanilla processing 'reflection' methods using
7+
# propane :library_proxy. See my_library.rb code for the guts.
8+
load_libraries :library_proxy, :plibrary
9+
10+
def settings
11+
size 300, 200
12+
end
13+
14+
def setup
15+
sketch_title 'Reflection Voodoo Proxy'
16+
MyLibrary.new self
17+
no_loop
18+
end
19+
20+
def draw
21+
fill(0, 0, 200)
22+
ellipse(170, 115, 70, 100)
23+
end
24+
end
25+
26+
LibraryProxySketch.new

0 commit comments

Comments
 (0)