glimmer-dsl-libui 0.2.15 → 0.2.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +597 -92
- data/VERSION +1 -1
- data/bin/girb +0 -0
- data/examples/area_gallery.rb +11 -18
- data/examples/area_gallery2.rb +31 -7
- data/examples/area_gallery3.rb +14 -21
- data/examples/area_gallery4.rb +34 -10
- data/examples/basic_transform.rb +8 -2
- data/examples/color_button.rb +1 -1
- data/examples/histogram.rb +6 -13
- data/examples/meta_example.rb +3 -1
- data/examples/tetris/model/block.rb +48 -0
- data/examples/tetris/model/game.rb +306 -0
- data/examples/tetris/model/past_game.rb +39 -0
- data/examples/tetris/model/tetromino.rb +329 -0
- data/examples/tetris.rb +262 -0
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/dsl/libui/shape_expression.rb +1 -0
- data/lib/glimmer/libui/control_proxy/area_proxy.rb +25 -0
- data/lib/glimmer/libui/control_proxy/path_proxy.rb +19 -7
- data/lib/glimmer/libui/shape/figure.rb +4 -2
- data/lib/glimmer/libui/shape/polybezier.rb +45 -0
- data/lib/glimmer/libui/shape/polygon.rb +46 -0
- data/lib/glimmer/libui/shape/polyline.rb +45 -0
- data/lib/glimmer/libui/shape.rb +9 -3
- metadata +10 -2
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.2.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.2.19
|
2
2
|
## Prerequisite-Free Ruby Desktop Development GUI Library
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
|
4
4
|
[![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
@@ -28,7 +28,16 @@ include Glimmer
|
|
28
28
|
window('hello world').show
|
29
29
|
```
|
30
30
|
|
31
|
+
Mac
|
32
|
+
|
31
33
|
![glimmer-dsl-libui-mac-basic-window.png](images/glimmer-dsl-libui-mac-basic-window.png)
|
34
|
+
|
35
|
+
Windows
|
36
|
+
|
37
|
+
![glimmer-dsl-libui-windows-basic-window.png](images/glimmer-dsl-libui-windows-basic-window.png)
|
38
|
+
|
39
|
+
Linux
|
40
|
+
|
32
41
|
![glimmer-dsl-libui-linux-basic-window.png](images/glimmer-dsl-libui-linux-basic-window.png)
|
33
42
|
|
34
43
|
Basic Table Progress Bar
|
@@ -68,7 +77,16 @@ window('Task Progress', 300, 200) {
|
|
68
77
|
}.show
|
69
78
|
```
|
70
79
|
|
80
|
+
Mac
|
81
|
+
|
71
82
|
![glimmer-dsl-libui-mac-basic-table-progress-bar.png](images/glimmer-dsl-libui-mac-basic-table-progress-bar.png)
|
83
|
+
|
84
|
+
Windows
|
85
|
+
|
86
|
+
![glimmer-dsl-libui-windows-basic-table-progress-bar.png](images/glimmer-dsl-libui-windows-basic-table-progress-bar.png)
|
87
|
+
|
88
|
+
Linux
|
89
|
+
|
72
90
|
![glimmer-dsl-libui-linux-basic-table-progress-bar.png](images/glimmer-dsl-libui-linux-basic-table-progress-bar.png)
|
73
91
|
|
74
92
|
Area Gallery
|
@@ -94,31 +112,24 @@ window('Area Gallery', 400, 400) {
|
|
94
112
|
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}]
|
95
113
|
}
|
96
114
|
path { # declarative stable path
|
97
|
-
|
98
|
-
|
99
|
-
line(400, 100)
|
100
|
-
line(400, 400)
|
101
|
-
|
102
|
-
closed true
|
103
|
-
}
|
104
|
-
|
115
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400)
|
116
|
+
|
105
117
|
fill r: 202, g: 102, b: 104, a: 0.5
|
106
118
|
stroke r: 0, g: 0, b: 0
|
107
119
|
}
|
108
120
|
path { # declarative stable path
|
109
|
-
|
110
|
-
bezier(200, 100, 100, 200, 400, 100)
|
111
|
-
bezier(300, 100, 100, 300, 100, 400)
|
112
|
-
bezier(100, 300, 300, 100, 400, 400)
|
113
|
-
|
114
|
-
closed true
|
115
|
-
}
|
121
|
+
polybezier(0, 0, 200, 100, 100, 200, 400, 100, 300, 100, 100, 300, 100, 400, 100, 300, 300, 100, 400, 400)
|
116
122
|
|
117
123
|
fill r: 202, g: 102, b: 204, a: 0.5
|
118
124
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
119
125
|
}
|
120
126
|
path { # declarative stable path
|
121
|
-
|
127
|
+
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
128
|
+
|
129
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
130
|
+
}
|
131
|
+
path { # declarative stable path
|
132
|
+
arc(404, 216, 190, 90, 90, false)
|
122
133
|
|
123
134
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
124
135
|
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}]
|
@@ -130,9 +141,9 @@ window('Area Gallery', 400, 400) {
|
|
130
141
|
fill r: 202, g: 102, b: 204, a: 0.5
|
131
142
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
132
143
|
}
|
133
|
-
text(
|
144
|
+
text(161, 40, 100) { # x, y, width
|
134
145
|
string('Area Gallery') {
|
135
|
-
font family: '
|
146
|
+
font family: 'Arial', size: 14
|
136
147
|
color :black
|
137
148
|
}
|
138
149
|
}
|
@@ -188,7 +199,16 @@ window('Area Gallery', 400, 400) {
|
|
188
199
|
}.show
|
189
200
|
```
|
190
201
|
|
202
|
+
Mac
|
203
|
+
|
191
204
|
![glimmer-dsl-libui-mac-area-gallery.png](images/glimmer-dsl-libui-mac-area-gallery.png)
|
205
|
+
|
206
|
+
Windows
|
207
|
+
|
208
|
+
![glimmer-dsl-libui-windows-area-gallery.png](images/glimmer-dsl-libui-windows-area-gallery.png)
|
209
|
+
|
210
|
+
Linux
|
211
|
+
|
192
212
|
![glimmer-dsl-libui-linux-area-gallery.png](images/glimmer-dsl-libui-linux-area-gallery.png)
|
193
213
|
|
194
214
|
[Check Out Many More Examples Over Here!](#examples)
|
@@ -257,6 +277,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
|
|
257
277
|
- [Basic Draw Text](#basic-draw-text)
|
258
278
|
- [Custom Draw Text](#custom-draw-text)
|
259
279
|
- [Method-Based Custom Keyword](#method-based-custom-keyword)
|
280
|
+
- [Tetris](#tetris)
|
260
281
|
- [Applications](#applications)
|
261
282
|
- [Manga2PDF](#manga2pdf)
|
262
283
|
- [Befunge98 GUI](#befunge98-gui)
|
@@ -349,7 +370,7 @@ gem install glimmer-dsl-libui
|
|
349
370
|
Or install via Bundler `Gemfile`:
|
350
371
|
|
351
372
|
```ruby
|
352
|
-
gem 'glimmer-dsl-libui', '~> 0.2.
|
373
|
+
gem 'glimmer-dsl-libui', '~> 0.2.19'
|
353
374
|
```
|
354
375
|
|
355
376
|
Add `require 'glimmer-dsl-libui'` at the top, and then `include Glimmer` into the top-level main object for testing or into an actual class for serious usage.
|
@@ -425,7 +446,7 @@ These are all the supported keywords. Note that some keywords do not represent c
|
|
425
446
|
Keyword(Args) | Properties | Listeners
|
426
447
|
------------- | ---------- | ---------
|
427
448
|
`about_menu_item` | None | `on_clicked`
|
428
|
-
`area` |
|
449
|
+
`area` | `auto_draw_enabled` | `on_draw(area_draw_params)`, `on_mouse_event(area_mouse_event)`, `on_mouse_down(area_mouse_event)`, `on_mouse_up(area_mouse_event)`, `on_mouse_drag_started(area_mouse_event)`, `on_mouse_dragged(area_mouse_event)`, `on_mouse_dropped(area_mouse_event)`, `on_mouse_entered`, `on_mouse_exited`, `on_key_event(area_key_event)`, `on_key_down(area_key_event)`, `on_key_up(area_key_event)`
|
429
450
|
`arc(x_center as Numeric, y_center as Numeric, radius as Numeric, start_angle as Numeric, sweep as Numeric, is_negative as Boolean)` | `x_center` (`Numeric`), `y_center` (`Numeric`), `radius` (`Numeric`), `start_angle` (`Numeric`), `sweep` (`Numeric`), `is_negative` (Boolean) | None
|
430
451
|
`background_color_column(name as String)` | None | None
|
431
452
|
`bezier(c1_x as Numeric, c1_y as Numeric, c2_x as Numeric, c2_y as Numeric, end_x as Numeric, end_y as Numeric)` | `c1_x` (`Numeric`), `c1_y` (`Numeric`), `c2_x` (`Numeric`), `c2_y` (`Numeric`), `end_x` (`Numeric`), `end_y` (`Numeric`) | None
|
@@ -466,6 +487,9 @@ Keyword(Args) | Properties | Listeners
|
|
466
487
|
`non_wrapping_multiline_entry` | `read_only` (Boolean), `text` (`String`) | `on_changed`
|
467
488
|
`password_entry` | `read_only` (Boolean), `text` (`String`) | `on_changed`
|
468
489
|
`path(draw_fill_mode = :winding)` | `fill` (`Hash` of `:r` as `0`-`255`, `:g` as `0`-`255`, `:b` as `0`-`255`, `:a` as `0.0`-`1.0`, hex, or [X11](https://en.wikipedia.org/wiki/X11_color_names) color), `stroke` (`Hash` of `:r` as `0`-`255`, `:g` as `0`-`255`, `:b` as `0`-`255`, `:a` as `0.0`-`1.0`, hex, or [X11](https://en.wikipedia.org/wiki/X11_color_names) color), `:cap` as (`:round`, `:square`, `:flat`), `:join` as (`:miter`, `:round`, `:bevel`), `:thickness` as `Numeric`, `:miter_limit` as `Numeric`, `:dashes` as `Array` of `Numeric` ) | None
|
490
|
+
`polygon(point_array as Array of Arrays of Numeric or Array of Numeric)` | `point_array` (`Array of Arrays of Numeric or Array of Numeric`) | None
|
491
|
+
`polyline(point_array as Array of Arrays of Numeric or Array of Numeric)` | `point_array` (`Array of Arrays of Numeric or Array of Numeric`) | None
|
492
|
+
`polybezier(point_array as Array of Arrays of Numeric or Array of Numeric)` | `point_array` (`Array of Arrays of Numeric or Array of Numeric`) | None
|
469
493
|
`preferences_menu_item` | None | `on_clicked`
|
470
494
|
`progress_bar` | `value` (`Numeric`) | None
|
471
495
|
`progress_bar_column(name as String)` | None | None
|
@@ -717,6 +741,9 @@ Available nested `path` shapes:
|
|
717
741
|
- `arc(x_center as Numeric, y_center as Numeric, radius as Numeric, start_angle as Numeric, sweep as Numeric, is_negative as Boolean)`
|
718
742
|
- `line(x as Numeric, y as Numeric)`
|
719
743
|
- `bezier(c1_x as Numeric, c1_y as Numeric, c2_x as Numeric, c2_y as Numeric, end_x as Numeric, end_y as Numeric)`
|
744
|
+
- `polygon(point_array as Array of Arrays of Numeric or Array of Numeric)`: closed figure of lines; can receive points as [[x1, y1], [x2, y2], ...] or [x1, y1, x2, y2, ...]
|
745
|
+
- `polyline(point_array as Array of Arrays of Numeric or Array of Numeric)`: open figure of lines; can receive points as [[x1, y1], [x2, y2], ...] or [x1, y1, x2, y2, ...]
|
746
|
+
- `polybezier(point_array as Array of Arrays of Numeric or Array of Numeric)`: open figure of beziers; can receive points as [[start_x1, start_y1], [c1_x2, c1_y2, c2_x2, c2_y2, end_x2, end_y2], [c1_x3, c1_y3, c2_x3, c2_y3, end_x3, end_y3], ...] or [start_x1, start_y1, c1_x2, c1_y2, c2_x2, c2_y2, end_x2, end_y2, c1_x3, c1_y3, c2_x3, c2_y3, end_x3, end_y3, ...]
|
720
747
|
- `figure(x=nil as Numeric, y=nil as Numeric)` (composite that can contain other shapes) (can set `closed true` to connect last point to first point automatically)
|
721
748
|
|
722
749
|
Check [examples/area_gallery.rb](#area-gallery) for an overiew of all `path` shapes.
|
@@ -771,6 +798,12 @@ Note that when nesting an `area` directly underneath `window` (without a layout
|
|
771
798
|
|
772
799
|
To redraw an `area`, you may call the `#queue_redraw_all` method, or simply `#redraw`.
|
773
800
|
|
801
|
+
`area` has the following Glimmer-added API methods/attributes:
|
802
|
+
- `request_auto_redraw`: requests auto redraw upon changes to nested stable `path` or shapes
|
803
|
+
- `pause_auto_redraw`: pause auto redraw upon changes to nested stable `path` or shapes (useful to avoid too many micro-change redraws, to group all redraws as one after many micro-changes)
|
804
|
+
- `resume_auto_redraw`: resume auto redraw upon changes to nested stable `path` or shapes
|
805
|
+
- `auto_redraw_enabled`/`auto_redraw_enabled?`/`auto_redraw_enabled=`: an attribute to disable/enable auto redraw on an `area` upon changes to nested stable `path` or shapes
|
806
|
+
|
774
807
|
A transform `matrix` can be set on a path by building a `matrix(m11 = nil, m12 = nil, m21 = nil, m22 = nil, m31 = nil, m32 = nil) {operations}` proxy object and then setting via `transform` property, or alternatively by building and setting the matrix in one call to `transform(m11 = nil, m12 = nil, m21 = nil, m22 = nil, m31 = nil, m32 = nil) {operations}` passing it the matrix arguments and/or content operations.
|
775
808
|
|
776
809
|
When instantiating a `matrix` object, it always starts with identity matrix.
|
@@ -1046,10 +1079,10 @@ window('Method-Based Custom Keyword') {
|
|
1046
1079
|
- `table` `checkbox_column` and `checkbox_text_column` checkbox editing only works on Linux and Windows (not Mac) due to a current limitation in [libui](https://github.com/andlabs/ui/issues/357).
|
1047
1080
|
- `text` `align` property seems not to work on the Mac ([libui](https://github.com/andlabs/libui) has an [issue](https://github.com/andlabs/libui/pull/407) about it)
|
1048
1081
|
- `text` `string` `background` does not work on Windows due to an [issue in libui](https://github.com/andlabs/libui/issues/347).
|
1049
|
-
- `arc` shape does not work on Windows unless a figure is started due to implementation of [libui](https://github.com/andlabs/libui).
|
1050
1082
|
- `table` controls on Windows intentionally get an extra empty row at the end because if any row were to be deleted for the first time, double-deletion happens due to an issue in [libui](https://github.com/andlabs/libui) on Windows.
|
1051
1083
|
- `table` `progress_bar` column on Windows cannot be updated with a positive value if it started initially with `-1` (it ignores update to avoid crashing due to an issue in [libui](https://github.com/andlabs/libui) on Windows.
|
1052
1084
|
- It seems that [libui](https://github.com/andlabs/libui) does not support nesting multiple `area` controls under a `grid` as only the first one shows up in that scenario. To workaround that limitation, use a `vertical_box` with nested `horizontal_box`s instead to include multiple `area`s in a GUI.
|
1085
|
+
- As per the code of [examples/basic_transform.rb](#basic-transform), Windows requires different ordering of transforms than Mac and Linux.
|
1053
1086
|
|
1054
1087
|
### Original API
|
1055
1088
|
|
@@ -1101,6 +1134,10 @@ Mac
|
|
1101
1134
|
|
1102
1135
|
![glimmer-dsl-libui-mac-meta-example.png](images/glimmer-dsl-libui-mac-meta-example.png)
|
1103
1136
|
|
1137
|
+
Windows
|
1138
|
+
|
1139
|
+
![glimmer-dsl-libui-windows-meta-example.png](images/glimmer-dsl-libui-windows-meta-example.png)
|
1140
|
+
|
1104
1141
|
Linux
|
1105
1142
|
|
1106
1143
|
![glimmer-dsl-libui-linux-meta-example.png](images/glimmer-dsl-libui-linux-meta-example.png)
|
@@ -1265,6 +1302,10 @@ Mac
|
|
1265
1302
|
|
1266
1303
|
![glimmer-dsl-libui-mac-basic-window.png](images/glimmer-dsl-libui-mac-basic-window.png)
|
1267
1304
|
|
1305
|
+
Windows
|
1306
|
+
|
1307
|
+
![glimmer-dsl-libui-windows-basic-window.png](images/glimmer-dsl-libui-windows-basic-window.png)
|
1308
|
+
|
1268
1309
|
Linux
|
1269
1310
|
|
1270
1311
|
![glimmer-dsl-libui-linux-basic-window.png](images/glimmer-dsl-libui-linux-basic-window.png)
|
@@ -1345,6 +1386,11 @@ Mac
|
|
1345
1386
|
![glimmer-dsl-libui-mac-basic-button.png](images/glimmer-dsl-libui-mac-basic-button.png)
|
1346
1387
|
![glimmer-dsl-libui-mac-basic-button-msg-box.png](images/glimmer-dsl-libui-mac-basic-button-msg-box.png)
|
1347
1388
|
|
1389
|
+
Windows
|
1390
|
+
|
1391
|
+
![glimmer-dsl-libui-windows-basic-button.png](images/glimmer-dsl-libui-windows-basic-button.png)
|
1392
|
+
![glimmer-dsl-libui-windows-basic-button-msg-box.png](images/glimmer-dsl-libui-windows-basic-button-msg-box.png)
|
1393
|
+
|
1348
1394
|
Linux
|
1349
1395
|
|
1350
1396
|
![glimmer-dsl-libui-linux-basic-button.png](images/glimmer-dsl-libui-linux-basic-button.png)
|
@@ -1422,6 +1468,11 @@ Mac
|
|
1422
1468
|
![glimmer-dsl-libui-mac-basic-entry.png](images/glimmer-dsl-libui-mac-basic-entry.png)
|
1423
1469
|
![glimmer-dsl-libui-mac-basic-entry-msg-box.png](images/glimmer-dsl-libui-mac-basic-entry-msg-box.png)
|
1424
1470
|
|
1471
|
+
Windows
|
1472
|
+
|
1473
|
+
![glimmer-dsl-libui-windows-basic-entry.png](images/glimmer-dsl-libui-windows-basic-entry.png)
|
1474
|
+
![glimmer-dsl-libui-windows-basic-entry-msg-box.png](images/glimmer-dsl-libui-windows-basic-entry-msg-box.png)
|
1475
|
+
|
1425
1476
|
Linux
|
1426
1477
|
|
1427
1478
|
![glimmer-dsl-libui-linux-basic-entry.png](images/glimmer-dsl-libui-linux-basic-entry.png)
|
@@ -1522,6 +1573,10 @@ Mac
|
|
1522
1573
|
|
1523
1574
|
![glimmer-dsl-libui-mac-simple-notepad.png](images/glimmer-dsl-libui-mac-simple-notepad.png)
|
1524
1575
|
|
1576
|
+
Windows
|
1577
|
+
|
1578
|
+
![glimmer-dsl-libui-windows-simple-notepad.png](images/glimmer-dsl-libui-windows-simple-notepad.png)
|
1579
|
+
|
1525
1580
|
Linux
|
1526
1581
|
|
1527
1582
|
![glimmer-dsl-libui-linux-simple-notepad.png](images/glimmer-dsl-libui-linux-simple-notepad.png)
|
@@ -1595,6 +1650,11 @@ Mac
|
|
1595
1650
|
![glimmer-dsl-libui-mac-midi-player.png](images/glimmer-dsl-libui-mac-midi-player.png)
|
1596
1651
|
![glimmer-dsl-libui-mac-midi-player-msg-box.png](images/glimmer-dsl-libui-mac-midi-player-msg-box.png)
|
1597
1652
|
|
1653
|
+
Windows
|
1654
|
+
|
1655
|
+
![glimmer-dsl-libui-windows-midi-player.png](images/glimmer-dsl-libui-windows-midi-player.png)
|
1656
|
+
![glimmer-dsl-libui-windows-midi-player-msg-box.png](images/glimmer-dsl-libui-windows-midi-player-msg-box.png)
|
1657
|
+
|
1598
1658
|
Linux
|
1599
1659
|
|
1600
1660
|
![glimmer-dsl-libui-linux-midi-player.png](images/glimmer-dsl-libui-linux-midi-player.png)
|
@@ -1812,6 +1872,10 @@ Mac
|
|
1812
1872
|
|
1813
1873
|
![glimmer-dsl-libui-mac-control-gallery.png](images/glimmer-dsl-libui-mac-control-gallery.png)
|
1814
1874
|
|
1875
|
+
Windows
|
1876
|
+
|
1877
|
+
![glimmer-dsl-libui-windows-control-gallery.png](images/glimmer-dsl-libui-windows-control-gallery.png)
|
1878
|
+
|
1815
1879
|
Linux
|
1816
1880
|
|
1817
1881
|
![glimmer-dsl-libui-linux-control-gallery.png](images/glimmer-dsl-libui-linux-control-gallery.png)
|
@@ -2203,6 +2267,11 @@ Mac
|
|
2203
2267
|
![glimmer-dsl-libui-mac-font-button.png](images/glimmer-dsl-libui-mac-font-button.png)
|
2204
2268
|
![glimmer-dsl-libui-mac-font-button-selection.png](images/glimmer-dsl-libui-mac-font-button-selection.png)
|
2205
2269
|
|
2270
|
+
Windows
|
2271
|
+
|
2272
|
+
![glimmer-dsl-libui-windows-font-button.png](images/glimmer-dsl-libui-windows-font-button.png)
|
2273
|
+
![glimmer-dsl-libui-windows-font-button-selection.png](images/glimmer-dsl-libui-windows-font-button-selection.png)
|
2274
|
+
|
2206
2275
|
Linux
|
2207
2276
|
|
2208
2277
|
![glimmer-dsl-libui-linux-font-button.png](images/glimmer-dsl-libui-linux-font-button.png)
|
@@ -2287,6 +2356,11 @@ Mac
|
|
2287
2356
|
![glimmer-dsl-libui-mac-color-button.png](images/glimmer-dsl-libui-mac-color-button.png)
|
2288
2357
|
![glimmer-dsl-libui-mac-color-button-selection.png](images/glimmer-dsl-libui-mac-color-button-selection.png)
|
2289
2358
|
|
2359
|
+
Windows
|
2360
|
+
|
2361
|
+
![glimmer-dsl-libui-windows-color-button.png](images/glimmer-dsl-libui-windows-color-button.png)
|
2362
|
+
![glimmer-dsl-libui-windows-color-button-selection.png](images/glimmer-dsl-libui-windows-color-button-selection.png)
|
2363
|
+
|
2290
2364
|
Linux
|
2291
2365
|
|
2292
2366
|
![glimmer-dsl-libui-linux-color-button.png](images/glimmer-dsl-libui-linux-color-button.png)
|
@@ -2299,7 +2373,7 @@ require 'glimmer-dsl-libui'
|
|
2299
2373
|
|
2300
2374
|
include Glimmer
|
2301
2375
|
|
2302
|
-
window('color button',
|
2376
|
+
window('color button', 240) {
|
2303
2377
|
color_button { |cb|
|
2304
2378
|
color :blue
|
2305
2379
|
|
@@ -2331,6 +2405,10 @@ Mac
|
|
2331
2405
|
|
2332
2406
|
![glimmer-dsl-libui-mac-date-time-picker.png](images/glimmer-dsl-libui-mac-date-time-picker.png)
|
2333
2407
|
|
2408
|
+
Windows
|
2409
|
+
|
2410
|
+
![glimmer-dsl-libui-windows-date-time-picker.png](images/glimmer-dsl-libui-windows-date-time-picker.png)
|
2411
|
+
|
2334
2412
|
Linux
|
2335
2413
|
|
2336
2414
|
![glimmer-dsl-libui-linux-date-time-picker.png](images/glimmer-dsl-libui-linux-date-time-picker.png)
|
@@ -2423,6 +2501,12 @@ Mac
|
|
2423
2501
|
![glimmer-dsl-libui-mac-grid-expand.png](images/glimmer-dsl-libui-mac-grid-expand.png)
|
2424
2502
|
![glimmer-dsl-libui-mac-grid-align.png](images/glimmer-dsl-libui-mac-grid-align.png)
|
2425
2503
|
|
2504
|
+
Windows
|
2505
|
+
|
2506
|
+
![glimmer-dsl-libui-windows-grid-span.png](images/glimmer-dsl-libui-windows-grid-span.png)
|
2507
|
+
![glimmer-dsl-libui-windows-grid-expand.png](images/glimmer-dsl-libui-windows-grid-expand.png)
|
2508
|
+
![glimmer-dsl-libui-windows-grid-align.png](images/glimmer-dsl-libui-windows-grid-align.png)
|
2509
|
+
|
2426
2510
|
Linux
|
2427
2511
|
|
2428
2512
|
![glimmer-dsl-libui-linux-grid-span.png](images/glimmer-dsl-libui-linux-grid-span.png)
|
@@ -2561,6 +2645,11 @@ Mac
|
|
2561
2645
|
![glimmer-dsl-libui-mac-form.png](images/glimmer-dsl-libui-mac-form.png)
|
2562
2646
|
![glimmer-dsl-libui-mac-form-msg-box.png](images/glimmer-dsl-libui-mac-form-msg-box.png)
|
2563
2647
|
|
2648
|
+
Windows
|
2649
|
+
|
2650
|
+
![glimmer-dsl-libui-windows-form.png](images/glimmer-dsl-libui-windows-form.png)
|
2651
|
+
![glimmer-dsl-libui-windows-form-msg-box.png](images/glimmer-dsl-libui-windows-form-msg-box.png)
|
2652
|
+
|
2564
2653
|
Linux
|
2565
2654
|
|
2566
2655
|
![glimmer-dsl-libui-linux-form.png](images/glimmer-dsl-libui-linux-form.png)
|
@@ -2626,6 +2715,10 @@ Mac
|
|
2626
2715
|
|
2627
2716
|
![glimmer-dsl-libui-mac-basic-table.png](images/glimmer-dsl-libui-mac-basic-table.png)
|
2628
2717
|
|
2718
|
+
Windows
|
2719
|
+
|
2720
|
+
![glimmer-dsl-libui-windows-basic-table.png](images/glimmer-dsl-libui-windows-basic-table.png)
|
2721
|
+
|
2629
2722
|
Linux
|
2630
2723
|
|
2631
2724
|
![glimmer-dsl-libui-linux-basic-table.png](images/glimmer-dsl-libui-linux-basic-table.png)
|
@@ -2748,6 +2841,12 @@ Mac
|
|
2748
2841
|
![glimmer-dsl-libui-mac-editable-table-editing.png](images/glimmer-dsl-libui-mac-editable-table-editing.png)
|
2749
2842
|
![glimmer-dsl-libui-mac-editable-table-edited.png](images/glimmer-dsl-libui-mac-editable-table-edited.png)
|
2750
2843
|
|
2844
|
+
Windows
|
2845
|
+
|
2846
|
+
![glimmer-dsl-libui-windows-editable-table.png](images/glimmer-dsl-libui-windows-editable-table.png)
|
2847
|
+
![glimmer-dsl-libui-windows-editable-table-editing.png](images/glimmer-dsl-libui-windows-editable-table-editing.png)
|
2848
|
+
![glimmer-dsl-libui-windows-editable-table-edited.png](images/glimmer-dsl-libui-windows-editable-table-edited.png)
|
2849
|
+
|
2751
2850
|
Linux
|
2752
2851
|
|
2753
2852
|
![glimmer-dsl-libui-linux-editable-table.png](images/glimmer-dsl-libui-linux-editable-table.png)
|
@@ -2815,6 +2914,11 @@ Mac
|
|
2815
2914
|
![glimmer-dsl-libui-mac-editable-column-table-editing.png](images/glimmer-dsl-libui-mac-editable-column-table-editing.png)
|
2816
2915
|
![glimmer-dsl-libui-mac-editable-column-table-edited.png](images/glimmer-dsl-libui-mac-editable-column-table-edited.png)
|
2817
2916
|
|
2917
|
+
Windows
|
2918
|
+
|
2919
|
+
![glimmer-dsl-libui-windows-editable-column-table-editing.png](images/glimmer-dsl-libui-windows-editable-column-table-editing.png)
|
2920
|
+
![glimmer-dsl-libui-windows-editable-column-table-edited.png](images/glimmer-dsl-libui-windows-editable-column-table-edited.png)
|
2921
|
+
|
2818
2922
|
Linux
|
2819
2923
|
|
2820
2924
|
![glimmer-dsl-libui-linux-editable-column-table-editing.png](images/glimmer-dsl-libui-linux-editable-column-table-editing.png)
|
@@ -2882,6 +2986,10 @@ Mac
|
|
2882
2986
|
|
2883
2987
|
![glimmer-dsl-libui-mac-basic-table-image.png](images/glimmer-dsl-libui-mac-basic-table-image.png)
|
2884
2988
|
|
2989
|
+
Windows
|
2990
|
+
|
2991
|
+
![glimmer-dsl-libui-windows-basic-table-image.png](images/glimmer-dsl-libui-windows-basic-table-image.png)
|
2992
|
+
|
2885
2993
|
Linux
|
2886
2994
|
|
2887
2995
|
![glimmer-dsl-libui-linux-basic-table-image.png](images/glimmer-dsl-libui-linux-basic-table-image.png)
|
@@ -3040,6 +3148,10 @@ Mac
|
|
3040
3148
|
|
3041
3149
|
![glimmer-dsl-libui-mac-basic-table-image-text.png](images/glimmer-dsl-libui-mac-basic-table-image-text.png)
|
3042
3150
|
|
3151
|
+
Windows
|
3152
|
+
|
3153
|
+
![glimmer-dsl-libui-windows-basic-table-image-text.png](images/glimmer-dsl-libui-windows-basic-table-image-text.png)
|
3154
|
+
|
3043
3155
|
Linux
|
3044
3156
|
|
3045
3157
|
![glimmer-dsl-libui-linux-basic-table-image-text.png](images/glimmer-dsl-libui-linux-basic-table-image-text.png)
|
@@ -3111,6 +3223,11 @@ Mac
|
|
3111
3223
|
![glimmer-dsl-libui-mac-basic-table-button.png](images/glimmer-dsl-libui-mac-basic-table-button.png)
|
3112
3224
|
![glimmer-dsl-libui-mac-basic-table-button-deleted.png](images/glimmer-dsl-libui-mac-basic-table-button-deleted.png)
|
3113
3225
|
|
3226
|
+
Windows
|
3227
|
+
|
3228
|
+
![glimmer-dsl-libui-windows-basic-table-button.png](images/glimmer-dsl-libui-windows-basic-table-button.png)
|
3229
|
+
![glimmer-dsl-libui-windows-basic-table-button-deleted.png](images/glimmer-dsl-libui-windows-basic-table-button-deleted.png)
|
3230
|
+
|
3114
3231
|
Linux
|
3115
3232
|
|
3116
3233
|
![glimmer-dsl-libui-linux-basic-table-button.png](images/glimmer-dsl-libui-linux-basic-table-button.png)
|
@@ -3172,6 +3289,10 @@ Mac
|
|
3172
3289
|
|
3173
3290
|
![glimmer-dsl-libui-mac-basic-table-checkbox.png](images/glimmer-dsl-libui-mac-basic-table-checkbox.png)
|
3174
3291
|
|
3292
|
+
Windows
|
3293
|
+
|
3294
|
+
![glimmer-dsl-libui-windows-basic-table-checkbox.png](images/glimmer-dsl-libui-windows-basic-table-checkbox.png)
|
3295
|
+
|
3175
3296
|
Linux
|
3176
3297
|
|
3177
3298
|
![glimmer-dsl-libui-linux-basic-table-checkbox.png](images/glimmer-dsl-libui-linux-basic-table-checkbox.png)
|
@@ -3224,6 +3345,10 @@ Mac
|
|
3224
3345
|
|
3225
3346
|
![glimmer-dsl-libui-mac-basic-table-checkbox-text.png](images/glimmer-dsl-libui-mac-basic-table-checkbox-text.png)
|
3226
3347
|
|
3348
|
+
Windows
|
3349
|
+
|
3350
|
+
![glimmer-dsl-libui-windows-basic-table-checkbox-text.png](images/glimmer-dsl-libui-windows-basic-table-checkbox-text.png)
|
3351
|
+
|
3227
3352
|
Linux
|
3228
3353
|
|
3229
3354
|
![glimmer-dsl-libui-linux-basic-table-checkbox-text.png](images/glimmer-dsl-libui-linux-basic-table-checkbox-text.png)
|
@@ -3276,6 +3401,10 @@ Mac
|
|
3276
3401
|
|
3277
3402
|
![glimmer-dsl-libui-mac-basic-table-progress-bar.png](images/glimmer-dsl-libui-mac-basic-table-progress-bar.png)
|
3278
3403
|
|
3404
|
+
Windows
|
3405
|
+
|
3406
|
+
![glimmer-dsl-libui-windows-basic-table-progress-bar.png](images/glimmer-dsl-libui-windows-basic-table-progress-bar.png)
|
3407
|
+
|
3279
3408
|
Linux
|
3280
3409
|
|
3281
3410
|
![glimmer-dsl-libui-linux-basic-table-progress-bar.png](images/glimmer-dsl-libui-linux-basic-table-progress-bar.png)
|
@@ -3343,6 +3472,10 @@ Mac
|
|
3343
3472
|
|
3344
3473
|
![glimmer-dsl-libui-mac-basic-table-color.png](images/glimmer-dsl-libui-mac-basic-table-color.png)
|
3345
3474
|
|
3475
|
+
Windows
|
3476
|
+
|
3477
|
+
![glimmer-dsl-libui-windows-basic-table-color.png](images/glimmer-dsl-libui-windows-basic-table-color.png)
|
3478
|
+
|
3346
3479
|
Linux
|
3347
3480
|
|
3348
3481
|
![glimmer-dsl-libui-linux-basic-table-color.png](images/glimmer-dsl-libui-linux-basic-table-color.png)
|
@@ -3411,6 +3544,12 @@ Mac
|
|
3411
3544
|
![glimmer-dsl-libui-mac-form-table-contact-entered.png](images/glimmer-dsl-libui-mac-form-table-contact-entered.png)
|
3412
3545
|
![glimmer-dsl-libui-mac-form-table-filtered.png](images/glimmer-dsl-libui-mac-form-table-filtered.png)
|
3413
3546
|
|
3547
|
+
Windows
|
3548
|
+
|
3549
|
+
![glimmer-dsl-libui-windows-form-table.png](images/glimmer-dsl-libui-windows-form-table.png)
|
3550
|
+
![glimmer-dsl-libui-windows-form-table-contact-entered.png](images/glimmer-dsl-libui-windows-form-table-contact-entered.png)
|
3551
|
+
![glimmer-dsl-libui-windows-form-table-filtered.png](images/glimmer-dsl-libui-windows-form-table-filtered.png)
|
3552
|
+
|
3414
3553
|
Linux
|
3415
3554
|
|
3416
3555
|
![glimmer-dsl-libui-linux-form-table.png](images/glimmer-dsl-libui-linux-form-table.png)
|
@@ -3531,6 +3670,10 @@ Mac
|
|
3531
3670
|
|
3532
3671
|
![glimmer-dsl-libui-mac-basic-area.png](images/glimmer-dsl-libui-mac-basic-area.png)
|
3533
3672
|
|
3673
|
+
Windows
|
3674
|
+
|
3675
|
+
![glimmer-dsl-libui-windows-basic-area.png](images/glimmer-dsl-libui-windows-basic-area.png)
|
3676
|
+
|
3534
3677
|
Linux
|
3535
3678
|
|
3536
3679
|
![glimmer-dsl-libui-linux-basic-area.png](images/glimmer-dsl-libui-linux-basic-area.png)
|
@@ -3654,6 +3797,11 @@ Mac
|
|
3654
3797
|
![glimmer-dsl-libui-mac-dynamic-area.png](images/glimmer-dsl-libui-mac-dynamic-area.png)
|
3655
3798
|
![glimmer-dsl-libui-mac-dynamic-area-updated.png](images/glimmer-dsl-libui-mac-dynamic-area-updated.png)
|
3656
3799
|
|
3800
|
+
Windows
|
3801
|
+
|
3802
|
+
![glimmer-dsl-libui-windows-dynamic-area.png](images/glimmer-dsl-libui-windows-dynamic-area.png)
|
3803
|
+
![glimmer-dsl-libui-windows-dynamic-area-updated.png](images/glimmer-dsl-libui-windows-dynamic-area-updated.png)
|
3804
|
+
|
3657
3805
|
Linux
|
3658
3806
|
|
3659
3807
|
![glimmer-dsl-libui-linux-dynamic-area.png](images/glimmer-dsl-libui-linux-dynamic-area.png)
|
@@ -3885,6 +4033,10 @@ Mac
|
|
3885
4033
|
|
3886
4034
|
![glimmer-dsl-libui-mac-area-gallery.png](images/glimmer-dsl-libui-mac-area-gallery.png)
|
3887
4035
|
|
4036
|
+
Windows
|
4037
|
+
|
4038
|
+
![glimmer-dsl-libui-windows-area-gallery.png](images/glimmer-dsl-libui-windows-area-gallery.png)
|
4039
|
+
|
3888
4040
|
Linux
|
3889
4041
|
|
3890
4042
|
![glimmer-dsl-libui-linux-area-gallery.png](images/glimmer-dsl-libui-linux-area-gallery.png)
|
@@ -3912,31 +4064,24 @@ window('Area Gallery', 400, 400) {
|
|
3912
4064
|
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}]
|
3913
4065
|
}
|
3914
4066
|
path { # declarative stable path
|
3915
|
-
|
3916
|
-
|
3917
|
-
line(400, 100)
|
3918
|
-
line(400, 400)
|
3919
|
-
|
3920
|
-
closed true
|
3921
|
-
}
|
3922
|
-
|
4067
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400)
|
4068
|
+
|
3923
4069
|
fill r: 202, g: 102, b: 104, a: 0.5
|
3924
4070
|
stroke r: 0, g: 0, b: 0
|
3925
4071
|
}
|
3926
4072
|
path { # declarative stable path
|
3927
|
-
|
3928
|
-
bezier(200, 100, 100, 200, 400, 100)
|
3929
|
-
bezier(300, 100, 100, 300, 100, 400)
|
3930
|
-
bezier(100, 300, 300, 100, 400, 400)
|
3931
|
-
|
3932
|
-
closed true
|
3933
|
-
}
|
4073
|
+
polybezier(0, 0, 200, 100, 100, 200, 400, 100, 300, 100, 100, 300, 100, 400, 100, 300, 300, 100, 400, 400)
|
3934
4074
|
|
3935
4075
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3936
4076
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
3937
4077
|
}
|
3938
4078
|
path { # declarative stable path
|
3939
|
-
|
4079
|
+
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
4080
|
+
|
4081
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
4082
|
+
}
|
4083
|
+
path { # declarative stable path
|
4084
|
+
arc(404, 216, 190, 90, 90, false)
|
3940
4085
|
|
3941
4086
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
3942
4087
|
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}]
|
@@ -3948,9 +4093,9 @@ window('Area Gallery', 400, 400) {
|
|
3948
4093
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3949
4094
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
3950
4095
|
}
|
3951
|
-
text(
|
4096
|
+
text(161, 40, 100) { # x, y, width
|
3952
4097
|
string('Area Gallery') {
|
3953
|
-
font family: '
|
4098
|
+
font family: 'Arial', size: 14
|
3954
4099
|
color :black
|
3955
4100
|
}
|
3956
4101
|
}
|
@@ -4099,18 +4244,42 @@ window('Area Gallery', 400, 400) {
|
|
4099
4244
|
end_x 400
|
4100
4245
|
end_y 400
|
4101
4246
|
}
|
4102
|
-
|
4103
|
-
closed true
|
4104
4247
|
}
|
4105
4248
|
|
4106
4249
|
fill r: 202, g: 102, b: 204, a: 0.5
|
4107
4250
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4108
4251
|
}
|
4252
|
+
path { # declarative stable path
|
4253
|
+
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
4254
|
+
figure {
|
4255
|
+
x 100
|
4256
|
+
y 100
|
4257
|
+
|
4258
|
+
line {
|
4259
|
+
x 400
|
4260
|
+
y 100
|
4261
|
+
}
|
4262
|
+
line {
|
4263
|
+
x 100
|
4264
|
+
y 400
|
4265
|
+
}
|
4266
|
+
line {
|
4267
|
+
x 400
|
4268
|
+
y 400
|
4269
|
+
}
|
4270
|
+
line {
|
4271
|
+
x 0
|
4272
|
+
y 0
|
4273
|
+
}
|
4274
|
+
}
|
4275
|
+
|
4276
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
4277
|
+
}
|
4109
4278
|
path { # declarative stable path
|
4110
4279
|
arc {
|
4111
|
-
x_center
|
4112
|
-
y_center
|
4113
|
-
radius
|
4280
|
+
x_center 404
|
4281
|
+
y_center 216
|
4282
|
+
radius 190
|
4114
4283
|
start_angle 90
|
4115
4284
|
sweep 90
|
4116
4285
|
is_negative false
|
@@ -4131,12 +4300,12 @@ window('Area Gallery', 400, 400) {
|
|
4131
4300
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
4132
4301
|
}
|
4133
4302
|
text {
|
4134
|
-
x
|
4303
|
+
x 161
|
4135
4304
|
y 40
|
4136
4305
|
width 100
|
4137
4306
|
|
4138
4307
|
string {
|
4139
|
-
font family: '
|
4308
|
+
font family: 'Arial', size: 14
|
4140
4309
|
color :black
|
4141
4310
|
|
4142
4311
|
'Area Gallery'
|
@@ -4207,42 +4376,35 @@ window('Area Gallery', 400, 400) {
|
|
4207
4376
|
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4208
4377
|
square(0, 0, 100)
|
4209
4378
|
square(100, 100, 400)
|
4210
|
-
|
4379
|
+
|
4211
4380
|
fill r: 102, g: 102, b: 204
|
4212
4381
|
}
|
4213
4382
|
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4214
4383
|
rectangle(0, 100, 100, 400)
|
4215
4384
|
rectangle(100, 0, 400, 100)
|
4216
|
-
|
4385
|
+
|
4217
4386
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
4218
4387
|
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}]
|
4219
4388
|
}
|
4220
4389
|
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4221
|
-
|
4222
|
-
|
4223
|
-
line(400, 100)
|
4224
|
-
line(400, 400)
|
4225
|
-
|
4226
|
-
closed true
|
4227
|
-
}
|
4228
|
-
|
4390
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400)
|
4391
|
+
|
4229
4392
|
fill r: 202, g: 102, b: 104, a: 0.5
|
4230
4393
|
stroke r: 0, g: 0, b: 0
|
4231
4394
|
}
|
4232
4395
|
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4233
|
-
|
4234
|
-
|
4235
|
-
bezier(300, 100, 100, 300, 100, 400)
|
4236
|
-
bezier(100, 300, 300, 100, 400, 400)
|
4237
|
-
|
4238
|
-
closed true
|
4239
|
-
}
|
4240
|
-
|
4396
|
+
polybezier(0, 0, 200, 100, 100, 200, 400, 100, 300, 100, 100, 300, 100, 400, 100, 300, 300, 100, 400, 400)
|
4397
|
+
|
4241
4398
|
fill r: 202, g: 102, b: 204, a: 0.5
|
4242
4399
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4243
4400
|
}
|
4244
4401
|
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4245
|
-
|
4402
|
+
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
4403
|
+
|
4404
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
4405
|
+
}
|
4406
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4407
|
+
arc(404, 216, 190, 90, 90, false)
|
4246
4408
|
|
4247
4409
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
4248
4410
|
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}]
|
@@ -4254,9 +4416,9 @@ window('Area Gallery', 400, 400) {
|
|
4254
4416
|
fill r: 202, g: 102, b: 204, a: 0.5
|
4255
4417
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
4256
4418
|
}
|
4257
|
-
text(
|
4419
|
+
text(161, 40, 100) { # x, y, width
|
4258
4420
|
string('Area Gallery') {
|
4259
|
-
font family: '
|
4421
|
+
font family: 'Arial', size: 14
|
4260
4422
|
color :black
|
4261
4423
|
}
|
4262
4424
|
}
|
@@ -4371,10 +4533,10 @@ window('Area Gallery', 400, 400) {
|
|
4371
4533
|
x 400
|
4372
4534
|
y 400
|
4373
4535
|
}
|
4374
|
-
|
4536
|
+
|
4375
4537
|
closed true
|
4376
4538
|
}
|
4377
|
-
|
4539
|
+
|
4378
4540
|
fill r: 202, g: 102, b: 104, a: 0.5
|
4379
4541
|
stroke r: 0, g: 0, b: 0
|
4380
4542
|
}
|
@@ -4407,18 +4569,42 @@ window('Area Gallery', 400, 400) {
|
|
4407
4569
|
end_x 400
|
4408
4570
|
end_y 400
|
4409
4571
|
}
|
4410
|
-
|
4411
|
-
closed true
|
4412
4572
|
}
|
4413
|
-
|
4573
|
+
|
4414
4574
|
fill r: 202, g: 102, b: 204, a: 0.5
|
4415
4575
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4416
4576
|
}
|
4577
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4578
|
+
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
4579
|
+
figure {
|
4580
|
+
x 100
|
4581
|
+
y 100
|
4582
|
+
|
4583
|
+
line {
|
4584
|
+
x 400
|
4585
|
+
y 100
|
4586
|
+
}
|
4587
|
+
line {
|
4588
|
+
x 100
|
4589
|
+
y 400
|
4590
|
+
}
|
4591
|
+
line {
|
4592
|
+
x 400
|
4593
|
+
y 400
|
4594
|
+
}
|
4595
|
+
line {
|
4596
|
+
x 0
|
4597
|
+
y 0
|
4598
|
+
}
|
4599
|
+
}
|
4600
|
+
|
4601
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
4602
|
+
}
|
4417
4603
|
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4418
4604
|
arc {
|
4419
|
-
x_center
|
4420
|
-
y_center
|
4421
|
-
radius
|
4605
|
+
x_center 404
|
4606
|
+
y_center 216
|
4607
|
+
radius 190
|
4422
4608
|
start_angle 90
|
4423
4609
|
sweep 90
|
4424
4610
|
is_negative false
|
@@ -4439,12 +4625,12 @@ window('Area Gallery', 400, 400) {
|
|
4439
4625
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
4440
4626
|
}
|
4441
4627
|
text {
|
4442
|
-
x
|
4628
|
+
x 161
|
4443
4629
|
y 40
|
4444
4630
|
width 100
|
4445
4631
|
|
4446
4632
|
string {
|
4447
|
-
font family: '
|
4633
|
+
font family: 'Arial', size: 14
|
4448
4634
|
color :black
|
4449
4635
|
|
4450
4636
|
'Area Gallery'
|
@@ -4523,6 +4709,10 @@ Mac
|
|
4523
4709
|
|
4524
4710
|
![glimmer-dsl-libui-mac-histogram.png](images/glimmer-dsl-libui-mac-histogram.png)
|
4525
4711
|
|
4712
|
+
Windows
|
4713
|
+
|
4714
|
+
![glimmer-dsl-libui-windows-histogram.png](images/glimmer-dsl-libui-windows-histogram.png)
|
4715
|
+
|
4526
4716
|
Linux
|
4527
4717
|
|
4528
4718
|
![glimmer-dsl-libui-linux-histogram.png](images/glimmer-dsl-libui-linux-histogram.png)
|
@@ -4757,20 +4947,13 @@ end
|
|
4757
4947
|
|
4758
4948
|
# method-based custom control representing a graph path
|
4759
4949
|
def graph_path(width, height, should_extend, &block)
|
4760
|
-
locations = point_locations(width, height)
|
4950
|
+
locations = point_locations(width, height).flatten
|
4761
4951
|
path {
|
4762
|
-
|
4763
|
-
|
4764
|
-
|
4765
|
-
|
4766
|
-
|
4767
|
-
if should_extend
|
4768
|
-
line(width, height)
|
4769
|
-
line(0, height)
|
4770
|
-
|
4771
|
-
closed true
|
4772
|
-
end
|
4773
|
-
}
|
4952
|
+
if should_extend
|
4953
|
+
polygon(locations + [width, height, 0, height])
|
4954
|
+
else
|
4955
|
+
polyline(locations)
|
4956
|
+
end
|
4774
4957
|
|
4775
4958
|
# apply a transform to the coordinate space for this path so (0, 0) is the top-left corner of the graph
|
4776
4959
|
transform {
|
@@ -4864,6 +5047,10 @@ Mac
|
|
4864
5047
|
|
4865
5048
|
![glimmer-dsl-libui-mac-basic-transform.png](images/glimmer-dsl-libui-mac-basic-transform.png)
|
4866
5049
|
|
5050
|
+
Windows
|
5051
|
+
|
5052
|
+
![glimmer-dsl-libui-windows-basic-transform.png](images/glimmer-dsl-libui-windows-basic-transform.png)
|
5053
|
+
|
4867
5054
|
Linux
|
4868
5055
|
|
4869
5056
|
![glimmer-dsl-libui-linux-basic-transform.png](images/glimmer-dsl-libui-linux-basic-transform.png)
|
@@ -4921,6 +5108,11 @@ Mac
|
|
4921
5108
|
![glimmer-dsl-libui-mac-login.png](images/glimmer-dsl-libui-mac-login.png)
|
4922
5109
|
![glimmer-dsl-libui-mac-login-logged-in.png](images/glimmer-dsl-libui-mac-login-logged-in.png)
|
4923
5110
|
|
5111
|
+
Windows
|
5112
|
+
|
5113
|
+
![glimmer-dsl-libui-windows-login.png](images/glimmer-dsl-libui-windows-login.png)
|
5114
|
+
![glimmer-dsl-libui-windows-login-logged-in.png](images/glimmer-dsl-libui-windows-login-logged-in.png)
|
5115
|
+
|
4924
5116
|
Linux
|
4925
5117
|
|
4926
5118
|
![glimmer-dsl-libui-linux-login.png](images/glimmer-dsl-libui-linux-login.png)
|
@@ -4997,6 +5189,11 @@ Mac
|
|
4997
5189
|
![glimmer-dsl-libui-mac-timer.png](images/glimmer-dsl-libui-mac-timer.png)
|
4998
5190
|
![glimmer-dsl-libui-mac-timer-in-progress.png](images/glimmer-dsl-libui-mac-timer-in-progress.png)
|
4999
5191
|
|
5192
|
+
Windows
|
5193
|
+
|
5194
|
+
![glimmer-dsl-libui-windows-timer.png](images/glimmer-dsl-libui-windows-timer.png)
|
5195
|
+
![glimmer-dsl-libui-windows-timer-in-progress.png](images/glimmer-dsl-libui-windows-timer-in-progress.png)
|
5196
|
+
|
5000
5197
|
Linux
|
5001
5198
|
|
5002
5199
|
![glimmer-dsl-libui-linux-timer.png](images/glimmer-dsl-libui-linux-timer.png)
|
@@ -5162,6 +5359,12 @@ Mac
|
|
5162
5359
|
![glimmer-dsl-libui-mac-color-the-circles-lost.png](images/glimmer-dsl-libui-mac-color-the-circles-lost.png)
|
5163
5360
|
![glimmer-dsl-libui-mac-color-the-circles-won.png](images/glimmer-dsl-libui-mac-color-the-circles-won.png)
|
5164
5361
|
|
5362
|
+
Windows
|
5363
|
+
|
5364
|
+
![glimmer-dsl-libui-windows-color-the-circles.png](images/glimmer-dsl-libui-windows-color-the-circles.png)
|
5365
|
+
![glimmer-dsl-libui-windows-color-the-circles-lost.png](images/glimmer-dsl-libui-windows-color-the-circles-lost.png)
|
5366
|
+
![glimmer-dsl-libui-windows-color-the-circles-won.png](images/glimmer-dsl-libui-windows-color-the-circles-won.png)
|
5367
|
+
|
5165
5368
|
Linux
|
5166
5369
|
|
5167
5370
|
![glimmer-dsl-libui-linux-color-the-circles.png](images/glimmer-dsl-libui-linux-color-the-circles.png)
|
@@ -5413,6 +5616,10 @@ Mac
|
|
5413
5616
|
|
5414
5617
|
![glimmer-dsl-libui-mac-basic-draw-text.png](images/glimmer-dsl-libui-mac-basic-draw-text.png)
|
5415
5618
|
|
5619
|
+
Windows
|
5620
|
+
|
5621
|
+
![glimmer-dsl-libui-windows-basic-draw-text.png](images/glimmer-dsl-libui-windows-basic-draw-text.png)
|
5622
|
+
|
5416
5623
|
Linux
|
5417
5624
|
|
5418
5625
|
![glimmer-dsl-libui-linux-basic-draw-text.png](images/glimmer-dsl-libui-linux-basic-draw-text.png)
|
@@ -5696,6 +5903,11 @@ Mac
|
|
5696
5903
|
![glimmer-dsl-libui-mac-custom-draw-text.png](images/glimmer-dsl-libui-mac-custom-draw-text.png)
|
5697
5904
|
![glimmer-dsl-libui-mac-custom-draw-text-changed.png](images/glimmer-dsl-libui-mac-custom-draw-text-changed.png)
|
5698
5905
|
|
5906
|
+
Windows
|
5907
|
+
|
5908
|
+
![glimmer-dsl-libui-windows-custom-draw-text.png](images/glimmer-dsl-libui-windows-custom-draw-text.png)
|
5909
|
+
![glimmer-dsl-libui-windows-custom-draw-text-changed.png](images/glimmer-dsl-libui-windows-custom-draw-text-changed.png)
|
5910
|
+
|
5699
5911
|
Linux
|
5700
5912
|
|
5701
5913
|
![glimmer-dsl-libui-linux-custom-draw-text.png](images/glimmer-dsl-libui-linux-custom-draw-text.png)
|
@@ -5910,6 +6122,10 @@ Mac
|
|
5910
6122
|
|
5911
6123
|
![glimmer-dsl-libui-mac-method-based-custom-keyword.png](images/glimmer-dsl-libui-mac-method-based-custom-keyword.png)
|
5912
6124
|
|
6125
|
+
Windows
|
6126
|
+
|
6127
|
+
![glimmer-dsl-libui-windows-method-based-custom-keyword.png](images/glimmer-dsl-libui-windows-method-based-custom-keyword.png)
|
6128
|
+
|
5913
6129
|
Linux
|
5914
6130
|
|
5915
6131
|
![glimmer-dsl-libui-linux-method-based-custom-keyword.png](images/glimmer-dsl-libui-linux-method-based-custom-keyword.png)
|
@@ -6016,6 +6232,295 @@ window('Method-Based Custom Keyword') {
|
|
6016
6232
|
}.show
|
6017
6233
|
```
|
6018
6234
|
|
6235
|
+
### Tetris
|
6236
|
+
|
6237
|
+
[examples/tetris.rb](examples/tetris.rb)
|
6238
|
+
|
6239
|
+
Run with this command from the root of the project if you cloned the project:
|
6240
|
+
|
6241
|
+
```
|
6242
|
+
ruby -r './lib/glimmer-dsl-libui' examples/tetris.rb
|
6243
|
+
```
|
6244
|
+
|
6245
|
+
Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
|
6246
|
+
|
6247
|
+
```
|
6248
|
+
ruby -r glimmer-dsl-libui -e "require 'examples/tetris'"
|
6249
|
+
```
|
6250
|
+
|
6251
|
+
Mac
|
6252
|
+
|
6253
|
+
![glimmer-dsl-libui-mac-tetris.png](images/glimmer-dsl-libui-mac-tetris.png)
|
6254
|
+
|
6255
|
+
![glimmer-dsl-libui-mac-tetris-game-over.png](images/glimmer-dsl-libui-mac-tetris-game-over.png)
|
6256
|
+
|
6257
|
+
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
6258
|
+
|
6259
|
+
```ruby
|
6260
|
+
require 'glimmer-dsl-libui'
|
6261
|
+
|
6262
|
+
require_relative 'tetris/model/game'
|
6263
|
+
|
6264
|
+
class Tetris
|
6265
|
+
include Glimmer
|
6266
|
+
|
6267
|
+
BLOCK_SIZE = 25
|
6268
|
+
BEVEL_CONSTANT = 20
|
6269
|
+
COLOR_GRAY = {r: 192, g: 192, b: 192}
|
6270
|
+
|
6271
|
+
attr_reader :game
|
6272
|
+
|
6273
|
+
def initialize
|
6274
|
+
@game = Model::Game.new
|
6275
|
+
end
|
6276
|
+
|
6277
|
+
def launch
|
6278
|
+
create_gui
|
6279
|
+
register_observers
|
6280
|
+
@game.start!
|
6281
|
+
@main_window.show
|
6282
|
+
end
|
6283
|
+
|
6284
|
+
def create_gui
|
6285
|
+
@main_window = window('Glimmer Tetris') {
|
6286
|
+
content_size Model::Game::PLAYFIELD_WIDTH * BLOCK_SIZE, Model::Game::PLAYFIELD_HEIGHT * BLOCK_SIZE + 98
|
6287
|
+
|
6288
|
+
vertical_box {
|
6289
|
+
label { # filler
|
6290
|
+
stretchy false
|
6291
|
+
}
|
6292
|
+
|
6293
|
+
score_board(block_size: BLOCK_SIZE) {
|
6294
|
+
stretchy false
|
6295
|
+
}
|
6296
|
+
|
6297
|
+
@playfield_blocks = playfield(playfield_width: Model::Game::PLAYFIELD_WIDTH, playfield_height: Model::Game::PLAYFIELD_HEIGHT, block_size: BLOCK_SIZE)
|
6298
|
+
}
|
6299
|
+
}
|
6300
|
+
end
|
6301
|
+
|
6302
|
+
def register_observers
|
6303
|
+
Glimmer::DataBinding::Observer.proc do |game_over|
|
6304
|
+
if game_over
|
6305
|
+
show_game_over_dialog
|
6306
|
+
else
|
6307
|
+
start_moving_tetrominos_down
|
6308
|
+
end
|
6309
|
+
end.observe(@game, :game_over)
|
6310
|
+
|
6311
|
+
Model::Game::PLAYFIELD_HEIGHT.times do |row|
|
6312
|
+
Model::Game::PLAYFIELD_WIDTH.times do |column|
|
6313
|
+
Glimmer::DataBinding::Observer.proc do |new_color|
|
6314
|
+
Glimmer::LibUI.queue_main do
|
6315
|
+
color = Glimmer::LibUI.interpret_color(new_color)
|
6316
|
+
block = @playfield_blocks[row][column]
|
6317
|
+
block[:background_square].fill = color
|
6318
|
+
block[:top_bevel_edge].fill = {r: color[:r] + 4*BEVEL_CONSTANT, g: color[:g] + 4*BEVEL_CONSTANT, b: color[:b] + 4*BEVEL_CONSTANT}
|
6319
|
+
block[:right_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
6320
|
+
block[:bottom_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
6321
|
+
block[:left_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
6322
|
+
block[:border_square].stroke = new_color == Model::Block::COLOR_CLEAR ? COLOR_GRAY : color
|
6323
|
+
end
|
6324
|
+
end.observe(@game.playfield[row][column], :color)
|
6325
|
+
end
|
6326
|
+
end
|
6327
|
+
|
6328
|
+
Model::Game::PREVIEW_PLAYFIELD_HEIGHT.times do |row|
|
6329
|
+
Model::Game::PREVIEW_PLAYFIELD_WIDTH.times do |column|
|
6330
|
+
Glimmer::DataBinding::Observer.proc do |new_color|
|
6331
|
+
Glimmer::LibUI.queue_main do
|
6332
|
+
color = Glimmer::LibUI.interpret_color(new_color)
|
6333
|
+
block = @preview_playfield_blocks[row][column]
|
6334
|
+
block[:background_square].fill = color
|
6335
|
+
block[:top_bevel_edge].fill = {r: color[:r] + 4*BEVEL_CONSTANT, g: color[:g] + 4*BEVEL_CONSTANT, b: color[:b] + 4*BEVEL_CONSTANT}
|
6336
|
+
block[:right_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
6337
|
+
block[:bottom_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
6338
|
+
block[:left_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
6339
|
+
block[:border_square].stroke = new_color == Model::Block::COLOR_CLEAR ? COLOR_GRAY : color
|
6340
|
+
end
|
6341
|
+
end.observe(@game.preview_playfield[row][column], :color)
|
6342
|
+
end
|
6343
|
+
end
|
6344
|
+
|
6345
|
+
Glimmer::DataBinding::Observer.proc do |new_score|
|
6346
|
+
Glimmer::LibUI.queue_main do
|
6347
|
+
@score_label.text = new_score.to_s
|
6348
|
+
end
|
6349
|
+
end.observe(@game, :score)
|
6350
|
+
|
6351
|
+
Glimmer::DataBinding::Observer.proc do |new_lines|
|
6352
|
+
Glimmer::LibUI.queue_main do
|
6353
|
+
@lines_label.text = new_lines.to_s
|
6354
|
+
end
|
6355
|
+
end.observe(@game, :lines)
|
6356
|
+
|
6357
|
+
Glimmer::DataBinding::Observer.proc do |new_level|
|
6358
|
+
Glimmer::LibUI.queue_main do
|
6359
|
+
@level_label.text = new_level.to_s
|
6360
|
+
end
|
6361
|
+
end.observe(@game, :level)
|
6362
|
+
end
|
6363
|
+
|
6364
|
+
def playfield(playfield_width: , playfield_height: , block_size: , &extra_content)
|
6365
|
+
blocks = []
|
6366
|
+
vertical_box {
|
6367
|
+
padded false
|
6368
|
+
|
6369
|
+
playfield_height.times.map do |row|
|
6370
|
+
blocks << []
|
6371
|
+
horizontal_box {
|
6372
|
+
padded false
|
6373
|
+
|
6374
|
+
playfield_width.times.map do |column|
|
6375
|
+
blocks.last << block(row: row, column: column, block_size: block_size)
|
6376
|
+
end
|
6377
|
+
}
|
6378
|
+
end
|
6379
|
+
|
6380
|
+
extra_content&.call
|
6381
|
+
}
|
6382
|
+
blocks
|
6383
|
+
end
|
6384
|
+
|
6385
|
+
def block(row: , column: , block_size: , &extra_content)
|
6386
|
+
block = {}
|
6387
|
+
bevel_pixel_size = 0.16 * block_size.to_f
|
6388
|
+
color = Glimmer::LibUI.interpret_color(Model::Block::COLOR_CLEAR)
|
6389
|
+
area {
|
6390
|
+
block[:background_square] = path {
|
6391
|
+
square(0, 0, block_size)
|
6392
|
+
|
6393
|
+
fill color
|
6394
|
+
}
|
6395
|
+
block[:top_bevel_edge] = path {
|
6396
|
+
polygon(0, 0, block_size, 0, block_size - bevel_pixel_size, bevel_pixel_size, bevel_pixel_size, bevel_pixel_size)
|
6397
|
+
|
6398
|
+
fill r: color[:r] + 4*BEVEL_CONSTANT, g: color[:g] + 4*BEVEL_CONSTANT, b: color[:b] + 4*BEVEL_CONSTANT
|
6399
|
+
}
|
6400
|
+
block[:right_bevel_edge] = path {
|
6401
|
+
polygon(block_size, 0, block_size - bevel_pixel_size, bevel_pixel_size, block_size - bevel_pixel_size, block_size - bevel_pixel_size, block_size, block_size)
|
6402
|
+
|
6403
|
+
fill r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT
|
6404
|
+
}
|
6405
|
+
block[:bottom_bevel_edge] = path {
|
6406
|
+
polygon(block_size, block_size, 0, block_size, bevel_pixel_size, block_size - bevel_pixel_size, block_size - bevel_pixel_size, block_size - bevel_pixel_size)
|
6407
|
+
|
6408
|
+
fill r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT
|
6409
|
+
}
|
6410
|
+
block[:left_bevel_edge] = path {
|
6411
|
+
polygon(0, 0, 0, block_size, bevel_pixel_size, block_size - bevel_pixel_size, bevel_pixel_size, bevel_pixel_size)
|
6412
|
+
|
6413
|
+
fill r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT
|
6414
|
+
}
|
6415
|
+
block[:border_square] = path {
|
6416
|
+
square(0, 0, block_size)
|
6417
|
+
|
6418
|
+
stroke COLOR_GRAY
|
6419
|
+
}
|
6420
|
+
|
6421
|
+
on_key_down do |key_event|
|
6422
|
+
case key_event
|
6423
|
+
in ext_key: :down
|
6424
|
+
game.down!
|
6425
|
+
in key: ' '
|
6426
|
+
game.down!(instant: true)
|
6427
|
+
in ext_key: :up
|
6428
|
+
case game.up_arrow_action
|
6429
|
+
when :instant_down
|
6430
|
+
game.down!(instant: true)
|
6431
|
+
when :rotate_right
|
6432
|
+
game.rotate!(:right)
|
6433
|
+
when :rotate_left
|
6434
|
+
game.rotate!(:left)
|
6435
|
+
end
|
6436
|
+
in ext_key: :left
|
6437
|
+
game.left!
|
6438
|
+
in ext_key: :right
|
6439
|
+
game.right!
|
6440
|
+
in modifier: :shift
|
6441
|
+
game.rotate!(:right)
|
6442
|
+
in modifier: :control
|
6443
|
+
game.rotate!(:left)
|
6444
|
+
else
|
6445
|
+
# Do Nothing
|
6446
|
+
end
|
6447
|
+
end
|
6448
|
+
|
6449
|
+
extra_content&.call
|
6450
|
+
}
|
6451
|
+
block
|
6452
|
+
end
|
6453
|
+
|
6454
|
+
def score_board(block_size: , &extra_content)
|
6455
|
+
vertical_box {
|
6456
|
+
horizontal_box {
|
6457
|
+
label # filler
|
6458
|
+
@preview_playfield_blocks = playfield(playfield_width: Model::Game::PREVIEW_PLAYFIELD_WIDTH, playfield_height: Model::Game::PREVIEW_PLAYFIELD_HEIGHT, block_size: block_size)
|
6459
|
+
label # filler
|
6460
|
+
}
|
6461
|
+
|
6462
|
+
horizontal_box {
|
6463
|
+
label # filler
|
6464
|
+
grid {
|
6465
|
+
stretchy false
|
6466
|
+
|
6467
|
+
label('Score') {
|
6468
|
+
left 0
|
6469
|
+
top 0
|
6470
|
+
halign :fill
|
6471
|
+
}
|
6472
|
+
@score_label = label {
|
6473
|
+
left 0
|
6474
|
+
top 1
|
6475
|
+
halign :center
|
6476
|
+
}
|
6477
|
+
|
6478
|
+
label('Lines') {
|
6479
|
+
left 1
|
6480
|
+
top 0
|
6481
|
+
halign :fill
|
6482
|
+
}
|
6483
|
+
@lines_label = label {
|
6484
|
+
left 1
|
6485
|
+
top 1
|
6486
|
+
halign :center
|
6487
|
+
}
|
6488
|
+
|
6489
|
+
label('Level') {
|
6490
|
+
left 2
|
6491
|
+
top 0
|
6492
|
+
halign :fill
|
6493
|
+
}
|
6494
|
+
@level_label = label {
|
6495
|
+
left 2
|
6496
|
+
top 1
|
6497
|
+
halign :center
|
6498
|
+
}
|
6499
|
+
}
|
6500
|
+
label # filler
|
6501
|
+
}
|
6502
|
+
|
6503
|
+
extra_content&.call
|
6504
|
+
}
|
6505
|
+
end
|
6506
|
+
|
6507
|
+
def start_moving_tetrominos_down
|
6508
|
+
Glimmer::LibUI.timer(@game.delay) do
|
6509
|
+
@game.down! if !@game.game_over? && !@game.paused?
|
6510
|
+
end
|
6511
|
+
end
|
6512
|
+
|
6513
|
+
def show_game_over_dialog
|
6514
|
+
Glimmer::LibUI.queue_main do
|
6515
|
+
msg_box('Game Over', "Score: #{@game.high_scores.first.score}\nLines: #{@game.high_scores.first.lines}\nLevel: #{@game.high_scores.first.level}")
|
6516
|
+
@game.restart!
|
6517
|
+
end
|
6518
|
+
end
|
6519
|
+
end
|
6520
|
+
|
6521
|
+
Tetris.new.launch
|
6522
|
+
```
|
6523
|
+
|
6019
6524
|
## Applications
|
6020
6525
|
|
6021
6526
|
Here are some applications built with [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui)
|