File tree Expand file tree Collapse file tree 8 files changed +148
-5
lines changed Expand file tree Collapse file tree 8 files changed +148
-5
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,8 @@ def settings
15
15
def setup
16
16
sketch_title 'Wishy Worm'
17
17
control_panel do |c |
18
- c . title = 'Control Panel'
19
- c . look_feel 'Nimbus '
18
+ c . title 'Control Panel'
19
+ c . look_feel 'Motif '
20
20
c . slider :bluish , 0.0 ..1.0 , 0.5
21
21
c . slider :alpha , 0.0 ..1.0 , 0.5
22
22
c . checkbox :go_big , false
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ def setup
17
17
sketch_title 'Quadratic Vertex'
18
18
@hide = false
19
19
control_panel do |c |
20
- c . title = 'Controller'
20
+ c . title 'Controller'
21
21
c . menu ( :detail , %w( 4 5 6 7 8 9 10 ) , '7' )
22
22
c . checkbox :debug
23
23
c . button :save_image
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env jruby -w
2
+ require 'propane'
3
+ class SimpleButton < Propane ::App
4
+ load_library :control_panel
5
+
6
+ attr_reader :hide , :panel , :back
7
+
8
+ def setup
9
+ sketch_title 'Simple Button'
10
+ control_panel do |c |
11
+ c . look_feel 'Nimbus'
12
+ c . title 'Control Button'
13
+ c . button :color_background # see method below
14
+ c . button ( :exit! ) { exit } # example of a button with a simple block
15
+ @panel = c
16
+ end
17
+ color_mode RGB , 1
18
+ @back = [ 0 , 0 , 1.0 ]
19
+ end
20
+
21
+ def color_background
22
+ @back = [ rand , rand , rand ]
23
+ end
24
+
25
+ def draw
26
+ # only make control_panel visible once, or again when hide is false
27
+ unless hide
28
+ @hide = true
29
+ panel . set_visible ( hide )
30
+ end
31
+ background *back
32
+ end
33
+
34
+ def settings
35
+ size 300 , 300
36
+ end
37
+ end
38
+
39
+ SimpleButton . new
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env jruby -w
2
+ require 'propane'
3
+ class Checkbox < Propane ::App
4
+ load_library :control_panel
5
+
6
+ attr_reader :hide , :panel , :shouting
7
+
8
+ def setup
9
+ sketch_title 'Simple Checkbox'
10
+ control_panel do |c |
11
+ c . look_feel 'Nimbus'
12
+ c . title 'Checkbox'
13
+ c . checkbox :shouting
14
+ @panel = c
15
+ end
16
+ text_font ( create_font ( 'mono' , 48 ) )
17
+ fill ( 200 , 0 , 0 )
18
+ end
19
+
20
+ def warning
21
+ shouting ? 'WARNING!' : 'warning!'
22
+ end
23
+
24
+ def draw
25
+ background 0
26
+ # only make control_panel visible once, or again when hide is false
27
+ unless hide
28
+ @hide = true
29
+ panel . set_visible ( hide )
30
+ end
31
+ text ( warning , 20 , 100 )
32
+ end
33
+
34
+ def settings
35
+ size 300 , 300
36
+ end
37
+ end
38
+
39
+ Checkbox . new
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env jruby -w
2
+ require 'propane'
3
+ class SimpleMenu < Propane ::App
4
+ load_library :control_panel
5
+
6
+ attr_reader :hide , :panel , :toggle_loop
7
+ def setup
8
+ sketch_title 'Simple Menu'
9
+ control_panel do |c |
10
+ c . look_feel 'Motif'
11
+ c . title 'Menu'
12
+ c . menu :choice , %i[ one two three ]
13
+ c . checkbox ( :toggle_loop ) { toggle_loop ? loop : no_loop }
14
+ @panel = c
15
+ end
16
+ end
17
+
18
+ def draw
19
+ # only make control_panel visible once, or again when hide is false
20
+ unless hide
21
+ @hide = true
22
+ panel . set_visible ( hide )
23
+ end
24
+ puts @choice
25
+ no_loop
26
+ end
27
+
28
+ def settings
29
+ size 300 , 300
30
+ end
31
+ end
32
+
33
+ SimpleMenu . new
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env jruby -w
2
+ require 'propane'
3
+ class SimpleSlider < Propane ::App
4
+ load_library :control_panel
5
+
6
+ attr_reader :hide , :panel , :bluish
7
+ def setup
8
+ sketch_title 'Simple Slider'
9
+ control_panel do |c |
10
+ c . look_feel 'Motif'
11
+ c . title 'Slider'
12
+ c . slider :bluish , 0.2 ..1.0 , 0.5
13
+ @panel = c
14
+ end
15
+ color_mode ( RGB , 1.0 )
16
+ end
17
+
18
+ def draw
19
+ # only make control_panel visible once, or again when hide is false
20
+ unless hide
21
+ @hide = true
22
+ panel . set_visible ( hide )
23
+ end
24
+ background ( 0 , 0 , bluish )
25
+ end
26
+
27
+ def settings
28
+ size 300 , 300
29
+ end
30
+ end
31
+
32
+ SimpleSlider . new
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class Penrose < Propane::App
14
14
def setup
15
15
sketch_title 'Penrose'
16
16
control_panel do |c |
17
- c . title = 'Tiler Control'
17
+ c . title 'Tiler Control'
18
18
c . look_feel 'Nimbus'
19
19
c . checkbox :seed
20
20
c . checkbox :acute
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ def setup
24
24
25
25
def setup_panel
26
26
control_panel do |c |
27
- c . title = 'Control:'
27
+ c . title 'Control:'
28
28
c . look_feel 'Metal'
29
29
c . slider :zoom , 1 ..8 , 3
30
30
c . slider :rot_y , -PI ..PI , 0
You can’t perform that action at this time.
0 commit comments