Skip to content

Commit c0209a6

Browse files
committed
add readme
1 parent 7bc15d5 commit c0209a6

File tree

6 files changed

+64
-69
lines changed

6 files changed

+64
-69
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# skatolo
2+
3+
### Skatolo is a GUI library for Processing, forked from [ControlP5](https://github.com/sojamo/controlp5)
4+
See repo on [github](https://github.com/Rea-lity-Tech/Skatolo) to run these examples you require gem version 1.1.4+ (if only 1.1.3 version is available from rubygems then clone repo to build)
5+
6+
### About
7+
8+
The skatolo java library was developed for an [advanced use of ControlP5](https://github.com/poqudrof/PapARt), it is not as convenient to use. It is a part of a research and development project involving multi-touch, augmented reality and Ruby. However it has also been adapted to work easily with JRubyArt (and hence propane). The skatolo library is developed by [Jeremy Laviole](http://jeremy.laviole.name/).
9+
10+
#### Sliders
11+
12+
If you name slider 'fred' then you will be able access the value as `fred_value`
13+
14+
#### Buttons
15+
16+
If you name the button 'my_method' you will be able create a method `:my_method` that gets called when button is pressed.
17+
18+
### Usage
19+
20+
Sketches need to `require 'skatolo'`, and `include EventMethod`, otherwise usage is similar to ControlP5 except `Skatolo.new(self)` instead of `ControlP5.new(self)`

external_library/gem/skatolo/button_group.rb

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
require 'skatolo'
2-
# In this simple sketch we attach two buttons to skatolo in the regular way,
3-
# named buttons 'press_me' and 'reset' thanks to some fancy metaprogramming
4-
# we can create methods :press_me and :reset for the buttons
2+
# In this simple sketch we attach three buttons to skatolo in the regular way,
3+
# and group them, then add the group to the accordion widget
4+
# named buttons 'red_color' ... thanks to some fancy metaprogramming
5+
# we can create methods :red_color, :green_color and :blue_color buttons
56

67
include EventMethod
8+
COLOR = %w[Red Green Blue].freeze
9+
710
attr_reader :skatolo, :back_color
811

912
def settings
@@ -36,21 +39,13 @@ def blue_color
3639
def create_gui
3740
@skatolo = Skatolo.new(self)
3841
color_group = skatolo.add_group('colors')
39-
skatolo.add_button('red_color')
40-
.set_group(color_group)
41-
.set_position(0, 10)
42-
.set_size(50, 20)
43-
.set_label('Red')
44-
skatolo.add_button('green_color')
45-
.set_group(color_group)
46-
.set_position(0, 30)
47-
.set_size(50, 20)
48-
.set_label('Green')
49-
skatolo.add_button('blue_color')
50-
.set_group(color_group)
51-
.set_position(0, 50)
52-
.set_size(50, 20)
53-
.set_label('Blue')
42+
%w[red_color green_color blue_color].freeze.each_with_index do |col, index|
43+
skatolo.add_button(col)
44+
.set_group(color_group)
45+
.set_position(0, 10 + index * 20)
46+
.set_size(50, 20)
47+
.set_label(COLOR[index])
48+
end
5449
skatolo.add_accordion('acc')
5550
.set_position(20, 10)
5651
.set_size(50, 20)

external_library/gem/skatolo/jwishy.rb

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def draw_shape(args)
7878
when 'triangle'
7979
draw_triangle(args)
8080
when 'square'
81-
rect(args[1], args[2], args[3], args[4])
81+
rect(*args.slice(1, 4))
8282
else
83-
oval(args[1], args[2], args[3], args[4]) # ellipse alias
83+
oval(*args.slice(1, 4)) # ellipse alias
8484
end
8585
end
8686

@@ -113,28 +113,18 @@ def create_gui
113113
.set_color_background(color(100))
114114
px = 10
115115
py = 15
116-
skatolo.add_slider('bluish')
117-
.set_size(sx, sy)
118-
.set_position(px, py += oy)
119-
.set_range(0, 1.0)
120-
.set_value(0.5)
121-
.set_group(control)
122-
skatolo.add_slider('alpha')
123-
.set_size(sx, sy)
124-
.set_position(px, py += oy)
125-
.set_range(0, 1.0)
126-
.set_value(0.5)
127-
.set_group(control)
128-
skatolo.add_button('toggle_big')
129-
.set_size(sx, 15)
130-
.set_position(px, py += oy)
131-
.set_group(control)
132-
skatolo.add_button('reset!')
133-
.set_size(sx, 15)
134-
.set_position(px, py += oy)
135-
.set_group(control)
136-
skatolo.add_button('random_shape')
137-
.set_size(sx, 15)
138-
.set_position(px, py += oy)
139-
.set_group(control)
116+
%w[bluish alpha].freeze.each do |slider|
117+
skatolo.add_slider(slider)
118+
.set_size(sx, sy)
119+
.set_position(px, py += oy)
120+
.set_range(0, 1.0)
121+
.set_value(0.5)
122+
.set_group(control)
123+
end
124+
%w[toggle_big reset! random_shape].freeze.each do |button|
125+
skatolo.add_button(button)
126+
.set_size(sx, 15)
127+
.set_position(px, py += oy)
128+
.set_group(control)
129+
end
140130
end

external_library/gem/skatolo/slider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'skatolo'
22
# In this simple sketch we attach a slider to skatolo in the regular way, with
33
# a named slider 'background_color' and thanks to some fancy metaprogramming
4-
# we can read the result from background_color_value
4+
# we can read the result from background_color_value in the sketch
55
include EventMethod
66
attr_reader :skatolo
77

external_library/gem/skatolo/slider_group.rb

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'skatolo'
2-
# In this simple sketch we attach two buttons to skatolo in the regular way,
3-
# named buttons 'press_me' and 'reset' thanks to some fancy metaprogramming
4-
# we can create methods :press_me and :reset for the buttons
2+
# In this simple sketch we attach three sliders to skatolo in the regular way,
3+
# then group them and attach to an accordion widget, the slider values are sent
4+
# (auto-magically) to the sketch as red_value, green_value and blue_value
55

66
include EventMethod
77
attr_reader :skatolo, :back_color
@@ -24,24 +24,14 @@ def draw
2424
def create_gui
2525
@skatolo = Skatolo.new(self)
2626
color_group = skatolo.add_group('colors')
27-
skatolo.add_slider('red')
28-
.set_group(color_group)
29-
.set_size(100, 15)
30-
.set_position(0, 10)
31-
.set_range(0, 255)
32-
.set_value(50)
33-
skatolo.add_slider('green')
34-
.set_group(color_group)
35-
.set_size(100, 15)
36-
.set_position(0, 30)
37-
.set_range(0, 255)
38-
.set_value(50)
39-
skatolo.add_slider('blue')
40-
.set_group(color_group)
41-
.set_size(100, 15)
42-
.set_position(0, 50)
43-
.set_range(0, 255)
44-
.set_value(50)
27+
%w[red green blue].freeze.each_with_index do |slider, index|
28+
skatolo.add_slider(slider)
29+
.set_group(color_group)
30+
.set_size(100, 15)
31+
.set_position(0, 10 + 20 * index)
32+
.set_range(0, 255)
33+
.set_value(50)
34+
end
4535
skatolo.add_accordion('acc')
4636
.set_position(10, 10)
4737
.set_size(120, 20)

external_library/gem/skatolo/text_box.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'skatolo'
2-
# In this simple sketch we attach two buttons to skatolo in the regular way,
3-
# named buttons 'press_me' and 'reset' thanks to some fancy metaprogramming
4-
# we can create methods :press_me and :reset for the buttons
2+
# In this simple sketch we attach a button to skatolo in the regular way,
3+
# and textfield widget. We can create a method :press_me and print the value of
4+
# the textfield, ps: make sure you do return on texfield entry
55
include EventMethod
66
attr_reader :skatolo, :back_color, :font, :name
77

0 commit comments

Comments
 (0)