glimmer-dsl-libui 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -0
- data/README.md +3859 -4006
- data/VERSION +1 -1
- data/bin/girb +0 -0
- data/examples/area_gallery.rb +19 -19
- data/examples/area_gallery2.rb +91 -89
- data/examples/area_gallery3.rb +19 -19
- data/examples/area_gallery4.rb +91 -89
- data/examples/basic_area.rb +1 -3
- data/examples/basic_area2.rb +1 -3
- data/examples/basic_area3.rb +17 -0
- data/examples/basic_area4.rb +19 -0
- data/examples/basic_scrolling_area.rb +79 -0
- data/examples/basic_transform.rb +3 -6
- data/examples/basic_transform2.rb +34 -0
- data/examples/color_the_circles.rb +1 -3
- data/examples/dynamic_area.rb +1 -3
- data/examples/dynamic_area2.rb +5 -7
- data/examples/form_table.rb +4 -0
- data/examples/grid.rb +4 -4
- data/examples/histogram.rb +4 -8
- data/examples/meta_example.rb +50 -10
- data/examples/midi_player.rb +2 -6
- data/examples/snake/model/game.rb +2 -2
- data/examples/snake.rb +9 -21
- data/examples/tetris.rb +15 -18
- data/examples/tic_tac_toe/board.rb +4 -2
- data/examples/tic_tac_toe.rb +4 -15
- data/examples/timer.rb +2 -6
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/dsl/libui/bind_expression.rb +36 -0
- data/lib/glimmer/dsl/libui/data_binding_expression.rb +47 -0
- data/lib/glimmer/dsl/libui/dsl.rb +3 -0
- data/lib/glimmer/dsl/libui/observe_expression.rb +35 -0
- data/lib/glimmer/dsl/libui/shape_expression.rb +6 -1
- data/lib/glimmer/dsl/libui/shine_data_binding_expression.rb +42 -0
- data/lib/glimmer/dsl/libui/string_expression.rb +4 -5
- data/lib/glimmer/libui/attributed_string.rb +19 -6
- data/lib/glimmer/libui/control_proxy/area_proxy/scrolling_area_proxy.rb +35 -0
- data/lib/glimmer/libui/control_proxy/window_proxy.rb +20 -0
- data/lib/glimmer/libui/shape.rb +50 -2
- metadata +15 -7
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/bin/girb
CHANGED
File without changes
|
data/examples/area_gallery.rb
CHANGED
@@ -4,50 +4,50 @@ include Glimmer
|
|
4
4
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
6
|
area {
|
7
|
-
path { # declarative stable path
|
7
|
+
path { # declarative stable path (explicit path syntax for multiple shapes sharing attributes)
|
8
8
|
square(0, 0, 100)
|
9
9
|
square(100, 100, 400)
|
10
|
-
|
10
|
+
|
11
11
|
fill r: 102, g: 102, b: 204
|
12
12
|
}
|
13
|
-
|
13
|
+
|
14
|
+
path { # declarative stable path (explicit path syntax for multiple shapes sharing attributes)
|
14
15
|
rectangle(0, 100, 100, 400)
|
15
16
|
rectangle(100, 0, 400, 100)
|
16
|
-
|
17
|
+
|
17
18
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
18
19
|
fill x0: 10, y0: 10, x1: 350, y1: 350, stops: [{pos: 0.25, r: 204, g: 102, b: 204}, {pos: 0.75, r: 102, g: 102, b: 204}]
|
19
20
|
}
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
|
22
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
23
23
|
fill r: 202, g: 102, b: 104, a: 0.5
|
24
24
|
stroke r: 0, g: 0, b: 0
|
25
25
|
}
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
|
27
|
+
polybezier(0, 0,
|
28
|
+
200, 100, 100, 200, 400, 100,
|
29
|
+
300, 100, 100, 300, 100, 400,
|
30
|
+
100, 300, 300, 100, 400, 400) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
29
31
|
fill r: 202, g: 102, b: 204, a: 0.5
|
30
32
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
31
33
|
}
|
32
|
-
path { # declarative stable path
|
33
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
34
34
|
|
35
|
+
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
35
36
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
36
37
|
}
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
|
39
|
+
arc(404, 216, 190, 90, 90, false) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
40
40
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
41
41
|
fill outer_radius: 90, x0: 0, y0: 0, x1: 500, y1: 500, stops: [{pos: 0.25, r: 102, g: 102, b: 204, a: 0.5}, {pos: 0.75, r: 204, g: 102, b: 204}]
|
42
42
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
43
43
|
}
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
|
45
|
+
circle(200, 200, 90) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
47
46
|
fill r: 202, g: 102, b: 204, a: 0.5
|
48
47
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
49
48
|
}
|
50
|
-
|
49
|
+
|
50
|
+
text(161, 40, 100) { # declarative stable text
|
51
51
|
string('Area Gallery') {
|
52
52
|
font family: 'Arial', size: (OS.mac? ? 14 : 11)
|
53
53
|
color :black
|
data/examples/area_gallery2.rb
CHANGED
@@ -4,12 +4,13 @@ include Glimmer
|
|
4
4
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
6
|
area {
|
7
|
-
path { # declarative stable path
|
7
|
+
path { # declarative stable path with explicit attributes (explicit path syntax for multiple shapes sharing attributes)
|
8
8
|
square {
|
9
9
|
x 0
|
10
10
|
y 0
|
11
11
|
length 100
|
12
12
|
}
|
13
|
+
|
13
14
|
square {
|
14
15
|
x 100
|
15
16
|
y 100
|
@@ -18,13 +19,15 @@ window('Area Gallery', 400, 400) {
|
|
18
19
|
|
19
20
|
fill r: 102, g: 102, b: 204
|
20
21
|
}
|
21
|
-
|
22
|
+
|
23
|
+
path { # declarative stable path with explicit attributes (explicit path syntax for multiple shapes sharing attributes)
|
22
24
|
rectangle {
|
23
25
|
x 0
|
24
26
|
y 100
|
25
27
|
width 100
|
26
28
|
height 400
|
27
29
|
}
|
30
|
+
|
28
31
|
rectangle {
|
29
32
|
x 100
|
30
33
|
y 0
|
@@ -35,115 +38,114 @@ window('Area Gallery', 400, 400) {
|
|
35
38
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
36
39
|
fill x0: 10, y0: 10, x1: 350, y1: 350, stops: [{pos: 0.25, r: 204, g: 102, b: 204}, {pos: 0.75, r: 102, g: 102, b: 204}]
|
37
40
|
}
|
38
|
-
|
39
|
-
|
41
|
+
|
42
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
43
|
+
x 100
|
44
|
+
y 100
|
45
|
+
|
46
|
+
line {
|
40
47
|
x 100
|
48
|
+
y 400
|
49
|
+
}
|
50
|
+
|
51
|
+
line {
|
52
|
+
x 400
|
41
53
|
y 100
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
line {
|
48
|
-
x 400
|
49
|
-
y 100
|
50
|
-
}
|
51
|
-
line {
|
52
|
-
x 400
|
53
|
-
y 400
|
54
|
-
}
|
55
|
-
|
56
|
-
closed true
|
54
|
+
}
|
55
|
+
|
56
|
+
line {
|
57
|
+
x 400
|
58
|
+
y 400
|
57
59
|
}
|
58
60
|
|
61
|
+
closed true # polygon figure is closed (last point forms a line with first point)
|
59
62
|
fill r: 202, g: 102, b: 104, a: 0.5
|
60
63
|
stroke r: 0, g: 0, b: 0
|
61
64
|
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
}
|
75
|
-
bezier {
|
76
|
-
c1_x 300
|
77
|
-
c1_y 100
|
78
|
-
c2_x 100
|
79
|
-
c2_y 300
|
80
|
-
end_x 100
|
81
|
-
end_y 400
|
82
|
-
}
|
83
|
-
bezier {
|
84
|
-
c1_x 100
|
85
|
-
c1_y 300
|
86
|
-
c2_x 300
|
87
|
-
c2_y 100
|
88
|
-
end_x 400
|
89
|
-
end_y 400
|
90
|
-
}
|
65
|
+
|
66
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
67
|
+
x 0
|
68
|
+
y 0
|
69
|
+
|
70
|
+
bezier {
|
71
|
+
c1_x 200
|
72
|
+
c1_y 100
|
73
|
+
c2_x 100
|
74
|
+
c2_y 200
|
75
|
+
end_x 400
|
76
|
+
end_y 100
|
91
77
|
}
|
92
|
-
|
78
|
+
|
79
|
+
bezier {
|
80
|
+
c1_x 300
|
81
|
+
c1_y 100
|
82
|
+
c2_x 100
|
83
|
+
c2_y 300
|
84
|
+
end_x 100
|
85
|
+
end_y 400
|
86
|
+
}
|
87
|
+
|
88
|
+
bezier {
|
89
|
+
c1_x 100
|
90
|
+
c1_y 300
|
91
|
+
c2_x 300
|
92
|
+
c2_y 100
|
93
|
+
end_x 400
|
94
|
+
end_y 400
|
95
|
+
}
|
96
|
+
|
93
97
|
fill r: 202, g: 102, b: 204, a: 0.5
|
94
98
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
95
99
|
}
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
+
|
101
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
102
|
+
x 100
|
103
|
+
y 100
|
104
|
+
|
105
|
+
line {
|
106
|
+
x 400
|
100
107
|
y 100
|
101
|
-
|
102
|
-
line {
|
103
|
-
x 400
|
104
|
-
y 100
|
105
|
-
}
|
106
|
-
line {
|
107
|
-
x 100
|
108
|
-
y 400
|
109
|
-
}
|
110
|
-
line {
|
111
|
-
x 400
|
112
|
-
y 400
|
113
|
-
}
|
114
|
-
line {
|
115
|
-
x 0
|
116
|
-
y 0
|
117
|
-
}
|
118
108
|
}
|
119
|
-
|
109
|
+
|
110
|
+
line {
|
111
|
+
x 100
|
112
|
+
y 400
|
113
|
+
}
|
114
|
+
|
115
|
+
line {
|
116
|
+
x 400
|
117
|
+
y 400
|
118
|
+
}
|
119
|
+
|
120
|
+
line {
|
121
|
+
x 0
|
122
|
+
y 0
|
123
|
+
}
|
124
|
+
|
120
125
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
121
126
|
}
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
}
|
131
|
-
|
127
|
+
|
128
|
+
arc { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
129
|
+
x_center 404
|
130
|
+
y_center 216
|
131
|
+
radius 190
|
132
|
+
start_angle 90
|
133
|
+
sweep 90
|
134
|
+
is_negative false
|
132
135
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
133
136
|
fill outer_radius: 90, x0: 0, y0: 0, x1: 500, y1: 500, stops: [{pos: 0.25, r: 102, g: 102, b: 204, a: 0.5}, {pos: 0.75, r: 204, g: 102, b: 204}]
|
134
137
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
135
138
|
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
}
|
142
|
-
|
139
|
+
|
140
|
+
circle { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
141
|
+
x_center 200
|
142
|
+
y_center 200
|
143
|
+
radius 90
|
143
144
|
fill r: 202, g: 102, b: 204, a: 0.5
|
144
145
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
145
146
|
}
|
146
|
-
|
147
|
+
|
148
|
+
text { # declarative stable text with explicit attributes
|
147
149
|
x 161
|
148
150
|
y 40
|
149
151
|
width 100
|
data/examples/area_gallery3.rb
CHANGED
@@ -5,50 +5,50 @@ include Glimmer
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
6
|
area {
|
7
7
|
on_draw do |area_draw_params|
|
8
|
-
path { #
|
8
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
9
9
|
square(0, 0, 100)
|
10
10
|
square(100, 100, 400)
|
11
|
-
|
11
|
+
|
12
12
|
fill r: 102, g: 102, b: 204
|
13
13
|
}
|
14
|
-
|
14
|
+
|
15
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
15
16
|
rectangle(0, 100, 100, 400)
|
16
17
|
rectangle(100, 0, 400, 100)
|
17
|
-
|
18
|
+
|
18
19
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
19
20
|
fill x0: 10, y0: 10, x1: 350, y1: 350, stops: [{pos: 0.25, r: 204, g: 102, b: 204}, {pos: 0.75, r: 102, g: 102, b: 204}]
|
20
21
|
}
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
|
23
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400) { # dynamic path, added semi-declaratively inside on_draw block
|
24
24
|
fill r: 202, g: 102, b: 104, a: 0.5
|
25
25
|
stroke r: 0, g: 0, b: 0
|
26
26
|
}
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
|
28
|
+
polybezier(0, 0,
|
29
|
+
200, 100, 100, 200, 400, 100,
|
30
|
+
300, 100, 100, 300, 100, 400,
|
31
|
+
100, 300, 300, 100, 400, 400) { # dynamic path, added semi-declaratively inside on_draw block
|
30
32
|
fill r: 202, g: 102, b: 204, a: 0.5
|
31
33
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
32
34
|
}
|
33
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
34
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
35
35
|
|
36
|
+
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0) { # dynamic path, added semi-declaratively inside on_draw block
|
36
37
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
37
38
|
}
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
|
40
|
+
arc(404, 216, 190, 90, 90, false) { # dynamic path, added semi-declaratively inside on_draw block
|
41
41
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
42
42
|
fill outer_radius: 90, x0: 0, y0: 0, x1: 500, y1: 500, stops: [{pos: 0.25, r: 102, g: 102, b: 204, a: 0.5}, {pos: 0.75, r: 204, g: 102, b: 204}]
|
43
43
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
44
44
|
}
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
|
46
|
+
circle(200, 200, 90) { # dynamic path, added semi-declaratively inside on_draw block
|
48
47
|
fill r: 202, g: 102, b: 204, a: 0.5
|
49
48
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
50
49
|
}
|
51
|
-
|
50
|
+
|
51
|
+
text(161, 40, 100) { # dynamic text added semi-declaratively inside on_draw block
|
52
52
|
string('Area Gallery') {
|
53
53
|
font family: 'Arial', size: (OS.mac? ? 14 : 11)
|
54
54
|
color :black
|
data/examples/area_gallery4.rb
CHANGED
@@ -5,12 +5,13 @@ include Glimmer
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
6
|
area {
|
7
7
|
on_draw do |area_draw_params|
|
8
|
-
path { #
|
8
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
9
9
|
square {
|
10
10
|
x 0
|
11
11
|
y 0
|
12
12
|
length 100
|
13
13
|
}
|
14
|
+
|
14
15
|
square {
|
15
16
|
x 100
|
16
17
|
y 100
|
@@ -19,13 +20,15 @@ window('Area Gallery', 400, 400) {
|
|
19
20
|
|
20
21
|
fill r: 102, g: 102, b: 204
|
21
22
|
}
|
22
|
-
|
23
|
+
|
24
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
23
25
|
rectangle {
|
24
26
|
x 0
|
25
27
|
y 100
|
26
28
|
width 100
|
27
29
|
height 400
|
28
30
|
}
|
31
|
+
|
29
32
|
rectangle {
|
30
33
|
x 100
|
31
34
|
y 0
|
@@ -36,115 +39,114 @@ window('Area Gallery', 400, 400) {
|
|
36
39
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
37
40
|
fill x0: 10, y0: 10, x1: 350, y1: 350, stops: [{pos: 0.25, r: 204, g: 102, b: 204}, {pos: 0.75, r: 102, g: 102, b: 204}]
|
38
41
|
}
|
39
|
-
|
40
|
-
|
42
|
+
|
43
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
44
|
+
x 100
|
45
|
+
y 100
|
46
|
+
|
47
|
+
line {
|
41
48
|
x 100
|
49
|
+
y 400
|
50
|
+
}
|
51
|
+
|
52
|
+
line {
|
53
|
+
x 400
|
42
54
|
y 100
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
line {
|
49
|
-
x 400
|
50
|
-
y 100
|
51
|
-
}
|
52
|
-
line {
|
53
|
-
x 400
|
54
|
-
y 400
|
55
|
-
}
|
56
|
-
|
57
|
-
closed true
|
55
|
+
}
|
56
|
+
|
57
|
+
line {
|
58
|
+
x 400
|
59
|
+
y 400
|
58
60
|
}
|
59
61
|
|
62
|
+
closed true # polygon figure is closed (last point forms a line with first point)
|
60
63
|
fill r: 202, g: 102, b: 104, a: 0.5
|
61
64
|
stroke r: 0, g: 0, b: 0
|
62
65
|
}
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
}
|
76
|
-
bezier {
|
77
|
-
c1_x 300
|
78
|
-
c1_y 100
|
79
|
-
c2_x 100
|
80
|
-
c2_y 300
|
81
|
-
end_x 100
|
82
|
-
end_y 400
|
83
|
-
}
|
84
|
-
bezier {
|
85
|
-
c1_x 100
|
86
|
-
c1_y 300
|
87
|
-
c2_x 300
|
88
|
-
c2_y 100
|
89
|
-
end_x 400
|
90
|
-
end_y 400
|
91
|
-
}
|
66
|
+
|
67
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
68
|
+
x 0
|
69
|
+
y 0
|
70
|
+
|
71
|
+
bezier {
|
72
|
+
c1_x 200
|
73
|
+
c1_y 100
|
74
|
+
c2_x 100
|
75
|
+
c2_y 200
|
76
|
+
end_x 400
|
77
|
+
end_y 100
|
92
78
|
}
|
93
|
-
|
79
|
+
|
80
|
+
bezier {
|
81
|
+
c1_x 300
|
82
|
+
c1_y 100
|
83
|
+
c2_x 100
|
84
|
+
c2_y 300
|
85
|
+
end_x 100
|
86
|
+
end_y 400
|
87
|
+
}
|
88
|
+
|
89
|
+
bezier {
|
90
|
+
c1_x 100
|
91
|
+
c1_y 300
|
92
|
+
c2_x 300
|
93
|
+
c2_y 100
|
94
|
+
end_x 400
|
95
|
+
end_y 400
|
96
|
+
}
|
97
|
+
|
94
98
|
fill r: 202, g: 102, b: 204, a: 0.5
|
95
99
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
96
100
|
}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
+
|
102
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
103
|
+
x 100
|
104
|
+
y 100
|
105
|
+
|
106
|
+
line {
|
107
|
+
x 400
|
101
108
|
y 100
|
102
|
-
|
103
|
-
line {
|
104
|
-
x 400
|
105
|
-
y 100
|
106
|
-
}
|
107
|
-
line {
|
108
|
-
x 100
|
109
|
-
y 400
|
110
|
-
}
|
111
|
-
line {
|
112
|
-
x 400
|
113
|
-
y 400
|
114
|
-
}
|
115
|
-
line {
|
116
|
-
x 0
|
117
|
-
y 0
|
118
|
-
}
|
119
109
|
}
|
120
|
-
|
110
|
+
|
111
|
+
line {
|
112
|
+
x 100
|
113
|
+
y 400
|
114
|
+
}
|
115
|
+
|
116
|
+
line {
|
117
|
+
x 400
|
118
|
+
y 400
|
119
|
+
}
|
120
|
+
|
121
|
+
line {
|
122
|
+
x 0
|
123
|
+
y 0
|
124
|
+
}
|
125
|
+
|
121
126
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
122
127
|
}
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
}
|
132
|
-
|
128
|
+
|
129
|
+
arc { # dynamic path, added semi-declaratively inside on_draw block
|
130
|
+
x_center 404
|
131
|
+
y_center 216
|
132
|
+
radius 190
|
133
|
+
start_angle 90
|
134
|
+
sweep 90
|
135
|
+
is_negative false
|
133
136
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
134
137
|
fill outer_radius: 90, x0: 0, y0: 0, x1: 500, y1: 500, stops: [{pos: 0.25, r: 102, g: 102, b: 204, a: 0.5}, {pos: 0.75, r: 204, g: 102, b: 204}]
|
135
138
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
136
139
|
}
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
}
|
143
|
-
|
140
|
+
|
141
|
+
circle { # dynamic path, added semi-declaratively inside on_draw block
|
142
|
+
x_center 200
|
143
|
+
y_center 200
|
144
|
+
radius 90
|
144
145
|
fill r: 202, g: 102, b: 204, a: 0.5
|
145
146
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
146
147
|
}
|
147
|
-
|
148
|
+
|
149
|
+
text { # dynamic path, added semi-declaratively inside on_draw block
|
148
150
|
x 161
|
149
151
|
y 40
|
150
152
|
width 100
|
data/examples/basic_area.rb
CHANGED
@@ -7,9 +7,7 @@ window('Basic Area', 400, 400) {
|
|
7
7
|
|
8
8
|
vertical_box {
|
9
9
|
area {
|
10
|
-
|
11
|
-
rectangle(0, 0, 400, 400)
|
12
|
-
|
10
|
+
rectangle(0, 0, 400, 400) { # stable implicit path shape, added declaratively
|
13
11
|
fill r: 102, g: 102, b: 204, a: 1.0
|
14
12
|
}
|
15
13
|
}
|
data/examples/basic_area2.rb
CHANGED
@@ -8,9 +8,7 @@ window('Basic Area', 400, 400) {
|
|
8
8
|
vertical_box {
|
9
9
|
area {
|
10
10
|
on_draw do |area_draw_params|
|
11
|
-
|
12
|
-
rectangle(0, 0, 400, 400)
|
13
|
-
|
11
|
+
rectangle(0, 0, 400, 400) { # dynamic implicit path shape, added semi-declaratively inside on_draw block
|
14
12
|
fill r: 102, g: 102, b: 204, a: 1.0
|
15
13
|
}
|
16
14
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'glimmer-dsl-libui'
|
2
|
+
|
3
|
+
include Glimmer
|
4
|
+
|
5
|
+
window('Basic Area', 400, 400) {
|
6
|
+
margined true
|
7
|
+
|
8
|
+
vertical_box {
|
9
|
+
area {
|
10
|
+
path { # stable path, added declaratively
|
11
|
+
rectangle(0, 0, 400, 400)
|
12
|
+
|
13
|
+
fill r: 102, g: 102, b: 204, a: 1.0
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}.show
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'glimmer-dsl-libui'
|
2
|
+
|
3
|
+
include Glimmer
|
4
|
+
|
5
|
+
window('Basic Area', 400, 400) {
|
6
|
+
margined true
|
7
|
+
|
8
|
+
vertical_box {
|
9
|
+
area {
|
10
|
+
on_draw do |area_draw_params|
|
11
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
12
|
+
rectangle(0, 0, 400, 400)
|
13
|
+
|
14
|
+
fill r: 102, g: 102, b: 204, a: 1.0
|
15
|
+
}
|
16
|
+
end
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}.show
|