glimmer-dsl-libui 0.2.17 → 0.2.21

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.17
1
+ 0.2.21
@@ -18,31 +18,24 @@ window('Area Gallery', 400, 400) {
18
18
  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
19
  }
20
20
  path { # declarative stable path
21
- figure(100, 100) {
22
- line(100, 400)
23
- line(400, 100)
24
- line(400, 400)
25
-
26
- closed true
27
- }
28
-
21
+ polygon(100, 100, 100, 400, 400, 100, 400, 400)
22
+
29
23
  fill r: 202, g: 102, b: 104, a: 0.5
30
24
  stroke r: 0, g: 0, b: 0
31
25
  }
32
26
  path { # declarative stable path
33
- figure(0, 0) {
34
- bezier(200, 100, 100, 200, 400, 100)
35
- bezier(300, 100, 100, 300, 100, 400)
36
- bezier(100, 300, 300, 100, 400, 400)
37
-
38
- closed true
39
- }
27
+ polybezier(0, 0, 200, 100, 100, 200, 400, 100, 300, 100, 100, 300, 100, 400, 100, 300, 300, 100, 400, 400)
40
28
 
41
29
  fill r: 202, g: 102, b: 204, a: 0.5
42
30
  stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
43
31
  }
44
32
  path { # declarative stable path
45
- arc(400, 220, 180, 90, 90, false)
33
+ polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
34
+
35
+ stroke r: 0, g: 0, b: 0, thickness: 2
36
+ }
37
+ path { # declarative stable path
38
+ arc(404, 216, 190, 90, 90, false)
46
39
 
47
40
  # radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
48
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}]
@@ -54,9 +47,9 @@ window('Area Gallery', 400, 400) {
54
47
  fill r: 202, g: 102, b: 204, a: 0.5
55
48
  stroke r: 0, g: 0, b: 0, thickness: 2
56
49
  }
57
- text(160, 40, 100) { # x, y, width
50
+ text(161, 40, 100) { # x, y, width
58
51
  string('Area Gallery') {
59
- font family: 'Times', size: 14
52
+ font family: 'Arial', size: 14
60
53
  color :black
61
54
  }
62
55
  }
@@ -88,18 +88,42 @@ window('Area Gallery', 400, 400) {
88
88
  end_x 400
89
89
  end_y 400
90
90
  }
91
-
92
- closed true
93
91
  }
94
92
 
95
93
  fill r: 202, g: 102, b: 204, a: 0.5
96
94
  stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
97
95
  }
96
+ path { # declarative stable path
97
+ polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
98
+ figure {
99
+ x 100
100
+ 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
+ }
119
+
120
+ stroke r: 0, g: 0, b: 0, thickness: 2
121
+ }
98
122
  path { # declarative stable path
99
123
  arc {
100
- x_center 400
101
- y_center 220
102
- radius 180
124
+ x_center 404
125
+ y_center 216
126
+ radius 190
103
127
  start_angle 90
104
128
  sweep 90
105
129
  is_negative false
@@ -120,12 +144,12 @@ window('Area Gallery', 400, 400) {
120
144
  stroke r: 0, g: 0, b: 0, thickness: 2
121
145
  }
122
146
  text {
123
- x 160
147
+ x 161
124
148
  y 40
125
149
  width 100
126
150
 
127
151
  string {
128
- font family: 'Times', size: 14
152
+ font family: 'Arial', size: 14
129
153
  color :black
130
154
 
131
155
  'Area Gallery'
@@ -8,42 +8,35 @@ window('Area Gallery', 400, 400) {
8
8
  path { # a dynamic path is 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
  path { # a dynamic path is added semi-declaratively inside on_draw block
15
15
  rectangle(0, 100, 100, 400)
16
16
  rectangle(100, 0, 400, 100)
17
-
17
+
18
18
  # linear gradient (has x0, y0, x1, y1, and stops)
19
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}]
20
20
  }
21
21
  path { # a dynamic path is added semi-declaratively inside on_draw block
22
- figure(100, 100) {
23
- line(100, 400)
24
- line(400, 100)
25
- line(400, 400)
26
-
27
- closed true
28
- }
29
-
22
+ polygon(100, 100, 100, 400, 400, 100, 400, 400)
23
+
30
24
  fill r: 202, g: 102, b: 104, a: 0.5
31
25
  stroke r: 0, g: 0, b: 0
32
26
  }
33
27
  path { # a dynamic path is added semi-declaratively inside on_draw block
34
- figure(0, 0) {
35
- bezier(200, 100, 100, 200, 400, 100)
36
- bezier(300, 100, 100, 300, 100, 400)
37
- bezier(100, 300, 300, 100, 400, 400)
38
-
39
- closed true
40
- }
41
-
28
+ polybezier(0, 0, 200, 100, 100, 200, 400, 100, 300, 100, 100, 300, 100, 400, 100, 300, 300, 100, 400, 400)
29
+
42
30
  fill r: 202, g: 102, b: 204, a: 0.5
43
31
  stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
44
32
  }
45
33
  path { # a dynamic path is added semi-declaratively inside on_draw block
46
- arc(400, 220, 180, 90, 90, false)
34
+ polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
35
+
36
+ stroke r: 0, g: 0, b: 0, thickness: 2
37
+ }
38
+ path { # a dynamic path is added semi-declaratively inside on_draw block
39
+ arc(404, 216, 190, 90, 90, false)
47
40
 
48
41
  # radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
49
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}]
@@ -55,9 +48,9 @@ window('Area Gallery', 400, 400) {
55
48
  fill r: 202, g: 102, b: 204, a: 0.5
56
49
  stroke r: 0, g: 0, b: 0, thickness: 2
57
50
  }
58
- text(160, 40, 100) { # x, y, width
51
+ text(161, 40, 100) { # x, y, width
59
52
  string('Area Gallery') {
60
- font family: 'Times', size: 14
53
+ font family: 'Arial', size: 14
61
54
  color :black
62
55
  }
63
56
  }
@@ -53,10 +53,10 @@ window('Area Gallery', 400, 400) {
53
53
  x 400
54
54
  y 400
55
55
  }
56
-
56
+
57
57
  closed true
58
58
  }
59
-
59
+
60
60
  fill r: 202, g: 102, b: 104, a: 0.5
61
61
  stroke r: 0, g: 0, b: 0
62
62
  }
@@ -89,18 +89,42 @@ window('Area Gallery', 400, 400) {
89
89
  end_x 400
90
90
  end_y 400
91
91
  }
92
-
93
- closed true
94
92
  }
95
-
93
+
96
94
  fill r: 202, g: 102, b: 204, a: 0.5
97
95
  stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
98
96
  }
97
+ path { # a dynamic path is added semi-declaratively inside on_draw block
98
+ polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
99
+ figure {
100
+ x 100
101
+ 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
+ }
120
+
121
+ stroke r: 0, g: 0, b: 0, thickness: 2
122
+ }
99
123
  path { # a dynamic path is added semi-declaratively inside on_draw block
100
124
  arc {
101
- x_center 400
102
- y_center 220
103
- radius 180
125
+ x_center 404
126
+ y_center 216
127
+ radius 190
104
128
  start_angle 90
105
129
  sweep 90
106
130
  is_negative false
@@ -121,12 +145,12 @@ window('Area Gallery', 400, 400) {
121
145
  stroke r: 0, g: 0, b: 0, thickness: 2
122
146
  }
123
147
  text {
124
- x 160
148
+ x 161
125
149
  y 40
126
150
  width 100
127
151
 
128
152
  string {
129
- font family: 'Times', size: 14
153
+ font family: 'Arial', size: 14
130
154
  color :black
131
155
 
132
156
  'Area Gallery'
@@ -31,20 +31,13 @@ end
31
31
 
32
32
  # method-based custom control representing a graph path
33
33
  def graph_path(width, height, should_extend, &block)
34
- locations = point_locations(width, height)
34
+ locations = point_locations(width, height).flatten
35
35
  path {
36
- first_location = locations[0] # x and y
37
- figure(first_location[0], first_location[1]) {
38
- locations.each do |loc|
39
- line(loc[0], loc[1])
40
- end
41
- if should_extend
42
- line(width, height)
43
- line(0, height)
44
-
45
- closed true
46
- end
47
- }
36
+ if should_extend
37
+ polygon(locations + [width, height, 0, height])
38
+ else
39
+ polyline(locations)
40
+ end
48
41
 
49
42
  # apply a transform to the coordinate space for this path so (0, 0) is the top-left corner of the graph
50
43
  transform {
@@ -85,11 +85,13 @@ class Tetris
85
85
 
86
86
  def clear_high_scores!
87
87
  high_scores.clear
88
+ save_high_scores!
88
89
  end
89
90
 
90
91
  def add_high_score!
91
92
  self.added_high_score = true
92
93
  high_scores.prepend(PastGame.new("Player #{high_scores.count + 1}", score, lines, level))
94
+ save_high_scores!
93
95
  end
94
96
 
95
97
  def save_high_scores!
@@ -31,9 +31,9 @@ class Tetris
31
31
  LETTER_COLORS = {
32
32
  I: :cyan,
33
33
  J: :blue,
34
- L: :dark_yellow,
34
+ L: :olive,
35
35
  O: :yellow,
36
- S: :green,
36
+ S: :lime,
37
37
  T: :magenta,
38
38
  Z: :red,
39
39
  }