glimmer-dsl-libui 0.3.1 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +876 -1031
- 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/snake.rb +1 -3
- data/examples/tetris.rb +15 -18
- data/examples/tic_tac_toe/board.rb +4 -2
- data/examples/tic_tac_toe.rb +1 -3
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/dsl/libui/shape_expression.rb +6 -1
- data/lib/glimmer/libui/control_proxy/area_proxy/scrolling_area_proxy.rb +35 -0
- data/lib/glimmer/libui/control_proxy/image_proxy.rb +1 -2
- data/lib/glimmer/libui/control_proxy/window_proxy.rb +20 -0
- data/lib/glimmer/libui/shape.rb +49 -1
- metadata +9 -5
data/README.md
CHANGED
@@ -1,10 +1,14 @@
|
|
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.3.
|
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.3.4
|
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)
|
5
5
|
|
6
6
|
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [LibUI](https://github.com/kojix2/LibUI) is a prerequisite-free Ruby desktop development GUI library. No need to pre-install any prerequisites. Just install the gem and have platform-independent native GUI that just works!
|
7
7
|
|
8
|
+
Mac | Windows | Linux
|
9
|
+
----|---------|------
|
10
|
+
![glimmer-dsl-libui-mac-control-gallery.png](images/glimmer-dsl-libui-mac-control-gallery.png) | ![glimmer-dsl-libui-windows-control-gallery.png](images/glimmer-dsl-libui-windows-control-gallery.png) | ![glimmer-dsl-libui-linux-control-gallery.png](images/glimmer-dsl-libui-linux-control-gallery.png)
|
11
|
+
|
8
12
|
[LibUI](https://github.com/kojix2/LibUI) is a thin [Ruby](https://www.ruby-lang.org/en/) wrapper around [libui](https://github.com/andlabs/libui), a relatively new C GUI library that renders native controls on every platform (similar to [SWT](https://www.eclipse.org/swt/), but without the heavy weight of the [Java Virtual Machine](https://www.java.com/en/)).
|
9
13
|
|
10
14
|
The main trade-off in using [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) as opposed to [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) or [Glimmer DSL for Tk](https://github.com/AndyObtiva/glimmer-dsl-tk) is the fact that [SWT](https://www.eclipse.org/swt/) and [Tk](https://www.tcl.tk/) are more mature than mid-alpha [libui](https://github.com/andlabs/libui) as GUI toolkits. Still, if there is only a need to build a small simple application, [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) could be a good convenient choice due to having zero prerequisites beyond the dependencies included in the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui). Also, just like [Glimmer DSL for Tk](https://github.com/AndyObtiva/glimmer-dsl-tk), its apps start instantly and have a small memory footprint. [LibUI](https://github.com/kojix2/LibUI) is a promising new GUI toolkit that might prove quite worthy in the future.
|
@@ -28,17 +32,9 @@ include Glimmer
|
|
28
32
|
window('hello world').show
|
29
33
|
```
|
30
34
|
|
31
|
-
Mac
|
32
|
-
|
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
|
-
|
41
|
-
![glimmer-dsl-libui-linux-basic-window.png](images/glimmer-dsl-libui-linux-basic-window.png)
|
35
|
+
Mac | Windows | Linux
|
36
|
+
----|---------|------
|
37
|
+
![glimmer-dsl-libui-mac-basic-window.png](images/glimmer-dsl-libui-mac-basic-window.png) | ![glimmer-dsl-libui-windows-basic-window.png](images/glimmer-dsl-libui-windows-basic-window.png) | ![glimmer-dsl-libui-linux-basic-window.png](images/glimmer-dsl-libui-linux-basic-window.png)
|
42
38
|
|
43
39
|
Basic Table Progress Bar
|
44
40
|
|
@@ -77,17 +73,9 @@ window('Task Progress', 300, 200) {
|
|
77
73
|
}.show
|
78
74
|
```
|
79
75
|
|
80
|
-
Mac
|
81
|
-
|
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
|
-
|
90
|
-
![glimmer-dsl-libui-linux-basic-table-progress-bar.png](images/glimmer-dsl-libui-linux-basic-table-progress-bar.png)
|
76
|
+
Mac | Windows | Linux
|
77
|
+
----|---------|------
|
78
|
+
![glimmer-dsl-libui-mac-basic-table-progress-bar.png](images/glimmer-dsl-libui-mac-basic-table-progress-bar.png) | ![glimmer-dsl-libui-windows-basic-table-progress-bar.png](images/glimmer-dsl-libui-windows-basic-table-progress-bar.png) | ![glimmer-dsl-libui-linux-basic-table-progress-bar.png](images/glimmer-dsl-libui-linux-basic-table-progress-bar.png)
|
91
79
|
|
92
80
|
Area Gallery
|
93
81
|
|
@@ -98,50 +86,50 @@ include Glimmer
|
|
98
86
|
|
99
87
|
window('Area Gallery', 400, 400) {
|
100
88
|
area {
|
101
|
-
|
102
|
-
square(0, 0, 100)
|
103
|
-
square(100, 100, 400)
|
104
|
-
|
105
|
-
fill r: 102, g: 102, b: 204
|
106
|
-
}
|
107
|
-
path { # declarative stable path
|
108
|
-
rectangle(0, 100, 100, 400)
|
109
|
-
rectangle(100, 0, 400, 100)
|
110
|
-
|
111
|
-
# linear gradient (has x0, y0, x1, y1, and stops)
|
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}]
|
113
|
-
}
|
114
|
-
path { # declarative stable path
|
115
|
-
polygon(100, 100, 100, 400, 400, 100, 400, 400)
|
116
|
-
|
89
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
117
90
|
fill r: 202, g: 102, b: 104, a: 0.5
|
118
91
|
stroke r: 0, g: 0, b: 0
|
119
92
|
}
|
120
|
-
|
121
|
-
|
122
|
-
|
93
|
+
|
94
|
+
polybezier(0, 0,
|
95
|
+
200, 100, 100, 200, 400, 100,
|
96
|
+
300, 100, 100, 300, 100, 400,
|
97
|
+
100, 300, 300, 100, 400, 400) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
123
98
|
fill r: 202, g: 102, b: 204, a: 0.5
|
124
99
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
125
100
|
}
|
126
|
-
path { # declarative stable path
|
127
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
128
101
|
|
102
|
+
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)
|
129
103
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
130
104
|
}
|
131
|
-
|
132
|
-
|
133
|
-
|
105
|
+
|
106
|
+
arc(404, 216, 190, 90, 90, false) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
134
107
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
135
108
|
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}]
|
136
109
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
137
110
|
}
|
138
|
-
|
139
|
-
|
140
|
-
|
111
|
+
|
112
|
+
circle(200, 200, 90) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
141
113
|
fill r: 202, g: 102, b: 204, a: 0.5
|
142
114
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
143
115
|
}
|
144
|
-
|
116
|
+
|
117
|
+
path { # declarative stable path (explicit path syntax for multiple shapes sharing attributes)
|
118
|
+
square(0, 0, 100)
|
119
|
+
square(100, 100, 400)
|
120
|
+
|
121
|
+
fill r: 102, g: 102, b: 204
|
122
|
+
}
|
123
|
+
|
124
|
+
path { # declarative stable path (explicit path syntax for multiple shapes sharing attributes)
|
125
|
+
rectangle(0, 100, 100, 400)
|
126
|
+
rectangle(100, 0, 400, 100)
|
127
|
+
|
128
|
+
# linear gradient (has x0, y0, x1, y1, and stops)
|
129
|
+
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}]
|
130
|
+
}
|
131
|
+
|
132
|
+
text(161, 40, 100) { # declarative stable text
|
145
133
|
string('Area Gallery') {
|
146
134
|
font family: 'Arial', size: (OS.mac? ? 14 : 11)
|
147
135
|
color :black
|
@@ -199,20 +187,16 @@ window('Area Gallery', 400, 400) {
|
|
199
187
|
}.show
|
200
188
|
```
|
201
189
|
|
202
|
-
Mac
|
203
|
-
|
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
|
-
|
212
|
-
![glimmer-dsl-libui-linux-area-gallery.png](images/glimmer-dsl-libui-linux-area-gallery.png)
|
190
|
+
Mac | Windows | Linux
|
191
|
+
----|---------|------
|
192
|
+
![glimmer-dsl-libui-mac-area-gallery.png](images/glimmer-dsl-libui-mac-area-gallery.png) | ![glimmer-dsl-libui-windows-area-gallery.png](images/glimmer-dsl-libui-windows-area-gallery.png) | ![glimmer-dsl-libui-linux-area-gallery.png](images/glimmer-dsl-libui-linux-area-gallery.png)
|
213
193
|
|
214
194
|
[Check Out Many More Examples Over Here!](#examples)
|
215
195
|
|
196
|
+
Mac | Windows | Linux
|
197
|
+
----|---------|------
|
198
|
+
![glimmer-dsl-libui-mac-tetris.png](images/glimmer-dsl-libui-mac-tetris.png) | ![glimmer-dsl-libui-windows-tetris.png](images/glimmer-dsl-libui-windows-tetris.png) | ![glimmer-dsl-libui-linux-tetris.png](images/glimmer-dsl-libui-linux-tetris.png)
|
199
|
+
|
216
200
|
NOTE: [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) is feature-complete and in beta mode (though the C [libui](https://github.com/andlabs/libui) is still mid-alpha). Please help make better by contributing, adopting for small or low risk projects, and providing feedback. The more feedback and issues you report the better.
|
217
201
|
|
218
202
|
Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interested in:
|
@@ -238,6 +222,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
|
|
238
222
|
- [Extra Operations](#extra-operations)
|
239
223
|
- [Table API](#table-api)
|
240
224
|
- [Area API](#area-api)
|
225
|
+
- [Scrolling Area](#scrolling_area)
|
241
226
|
- [Area Path Shapes](#area-path-shapes)
|
242
227
|
- [Area Text](#area-text)
|
243
228
|
- [Area Image](#area-image)
|
@@ -277,6 +262,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
|
|
277
262
|
- [Form Table](#form-table)
|
278
263
|
- [Basic Area](#basic-area)
|
279
264
|
- [Dynamic Area](#dynamic-area)
|
265
|
+
- [Basic Scrolling Area](#basic-scrolling-area)
|
280
266
|
- [Area Gallery](#area-gallery)
|
281
267
|
- [Basic Image](#basic-image)
|
282
268
|
- [Histogram](#histogram)
|
@@ -382,7 +368,7 @@ gem install glimmer-dsl-libui
|
|
382
368
|
Or install via Bundler `Gemfile`:
|
383
369
|
|
384
370
|
```ruby
|
385
|
-
gem 'glimmer-dsl-libui', '~> 0.3.
|
371
|
+
gem 'glimmer-dsl-libui', '~> 0.3.4'
|
386
372
|
```
|
387
373
|
|
388
374
|
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.
|
@@ -453,6 +439,8 @@ w.libui # => #<Fiddle::Pointer:0x00007fde53997980 ptr=0x00007fde51352a60 size=0
|
|
453
439
|
|
454
440
|
### Supported Keywords
|
455
441
|
|
442
|
+
These are all the supported keywords. Note that some keywords do not represent controls, but produce objects that are used as the property values of controls (e.g. `image` can be used as a control under `area` or alternatively build objects to use in `cell_rows` for a `table` with an `image_column`)
|
443
|
+
|
456
444
|
Keyword(Args) | Properties | Listeners
|
457
445
|
------------- | ---------- | ---------
|
458
446
|
`about_menu_item` | None | `on_clicked`
|
@@ -480,7 +468,7 @@ Keyword(Args) | Properties | Listeners
|
|
480
468
|
`group(text as String)` | `margined` (Boolean), `title` (`String`) | None
|
481
469
|
`horizontal_box` | `padded` (Boolean) | None
|
482
470
|
`horizontal_separator` | None | None
|
483
|
-
`image(file as String = nil, width as Numeric = nil, height as Numeric = nil)` |
|
471
|
+
`image(file as String = nil, width as Numeric = nil, height as Numeric = nil)` | `file` (`String` path or URL), `width`, `height` | None
|
484
472
|
`image_part(pixels as String [encoded image rgba byte array], width as Numeric, height as Numeric, byte_stride as Numeric [usually width*4])` | None | None
|
485
473
|
`image_column(name as String)` | None | None
|
486
474
|
`image_text_column(name as String)` | None | None
|
@@ -507,6 +495,7 @@ Keyword(Args) | Properties | Listeners
|
|
507
495
|
`quit_menu_item` | None | `on_clicked`
|
508
496
|
`radio_buttons` | `selected` (`Integer`) | `on_selected`
|
509
497
|
`rectangle(x as Numeric, y as Numeric, width as Numeric, height as Numeric)` | `x` (`Numeric`), `y` (`Numeric`), `width` (`Numeric`), `height` (`Numeric`) | None
|
498
|
+
`scrolling_area(width = main_window.width, height = main_window.height)` | `auto_draw_enabled` (Boolean), `size` (`Array` of `width` (`Numeric`) and `height` (`Numeric`)), `width` (`Numeric`), `height` (`Numeric`) | `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)`
|
510
499
|
`search_entry` | `read_only` (Boolean), `text` (`String`) | `on_changed`
|
511
500
|
`separator_menu_item` | None | None
|
512
501
|
`slider(min as Numeric, max as Numeric)` | `value` (`Numeric`) | `on_changed`
|
@@ -522,7 +511,7 @@ Keyword(Args) | Properties | Listeners
|
|
522
511
|
`time_picker` | `time` (`Hash` of keys: `sec` as `Integer`, `min` as `Integer`, `hour` as `Integer`) | `on_changed`
|
523
512
|
`vertical_box` | `padded` (Boolean) | None
|
524
513
|
`vertical_separator` | None | None
|
525
|
-
`window(title as String, width as Integer, height as Integer, has_menubar as Boolean)` | `borderless` (Boolean), `content_size` (width `Numeric`, height `Numeric`), `fullscreen` (Boolean), `margined` (Boolean), `title` (`String`), `resizable` (Boolean) | `on_closing`, `on_content_size_changed`, `on_destroy`
|
514
|
+
`window(title as String, width as Integer, height as Integer, has_menubar as Boolean)` | `borderless` (Boolean), `content_size` (width `Numeric`, height `Numeric`), `width` (`Numeric`), `height` (`Numeric`), `fullscreen` (Boolean), `margined` (Boolean), `title` (`String`), `resizable` (Boolean) | `on_closing`, `on_content_size_changed`, `on_destroy`
|
526
515
|
|
527
516
|
### Common Control Properties
|
528
517
|
- `enabled` (Boolean)
|
@@ -722,7 +711,7 @@ Learn more by checking out [examples](#examples).
|
|
722
711
|
|
723
712
|
The `area` control is a canvas-like control for drawing paths that can be used in one of two ways:
|
724
713
|
- Declaratively via stable paths: useful for stable paths that will not change often later on. Simply nest `path` and figures like `rectangle` and all drawing logic is generated automatically. Path proxy objects are preserved across redraws assuming there would be relatively few stable paths (mostly for decorative reasons).
|
725
|
-
- Semi-declaratively via on_draw listener dynamic paths: useful for more dynamic paths that will definitely change very often. Open an `on_draw` listener block that receives
|
714
|
+
- Semi-declaratively via on_draw listener dynamic paths: useful for more dynamic paths that will definitely change very often. Open an `on_draw` listener block that receives an [`area_draw_params`](#area-draw-params) argument and nest `path` and figures like `rectangle` and all drawing logic is generated automatically. Path proxy objects are destroyed (thrown-away) at the end of drawing, thus having less memory overhead for drawing thousands of dynamic paths.
|
726
715
|
|
727
716
|
Note that when nesting an `area` directly underneath `window` (without a layout control like `vertical_box`), it is automatically reparented with `vertical_box` in between the `window` and `area` since it would not show up on Linux otherwise.
|
728
717
|
|
@@ -748,19 +737,11 @@ window('Basic Area', 400, 400) {
|
|
748
737
|
}.show
|
749
738
|
```
|
750
739
|
|
751
|
-
Mac
|
752
|
-
|
753
|
-
![glimmer-dsl-libui-mac-basic-area.png](images/glimmer-dsl-libui-mac-basic-area.png)
|
754
|
-
|
755
|
-
Windows
|
740
|
+
Mac | Windows | Linux
|
741
|
+
----|---------|------
|
742
|
+
![glimmer-dsl-libui-mac-basic-area.png](images/glimmer-dsl-libui-mac-basic-area.png) | ![glimmer-dsl-libui-windows-basic-area.png](images/glimmer-dsl-libui-windows-basic-area.png) | ![glimmer-dsl-libui-linux-basic-area.png](images/glimmer-dsl-libui-linux-basic-area.png)
|
756
743
|
|
757
|
-
|
758
|
-
|
759
|
-
Linux
|
760
|
-
|
761
|
-
![glimmer-dsl-libui-linux-basic-area.png](images/glimmer-dsl-libui-linux-basic-area.png)
|
762
|
-
|
763
|
-
Here is the same example using a semi-declarative `area` with `on_draw` listener that receives a `area_draw_params` argument and a dynamic path (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
744
|
+
Here is the same example using a semi-declarative `area` with `on_draw` listener that receives a [`area_draw_params`](#area-draw-params) argument and a dynamic path (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
764
745
|
|
765
746
|
```ruby
|
766
747
|
require 'glimmer-dsl-libui'
|
@@ -786,6 +767,18 @@ window('Basic Area', 400, 400) {
|
|
786
767
|
|
787
768
|
Check [examples/dynamic_area.rb](#dynamic-area) for a more detailed semi-declarative example.
|
788
769
|
|
770
|
+
#### Scrolling Area
|
771
|
+
|
772
|
+
`scrolling_area(width as Numeric = main_window.width, height as Numeric = main_window.height)` is similar to `area`, but has the following additional methods:
|
773
|
+
- `scroll_to(x as Numeric, y as Numeric, width as Numeric = main_window.width, height as Numeric = main_window.height)`: scrolls to `x`/`y` location with `width` and `height` viewport size.
|
774
|
+
- `set_size(width as Numeric, height as Numeric)`: set size of scrolling area, which must must exceed that of visible viewport in order for scrolling to be enabled.
|
775
|
+
|
776
|
+
Mac |
|
777
|
+
----|
|
778
|
+
![glimmer-dsl-libui-mac-dynamic-area.png](images/glimmer-dsl-libui-mac-basic-scrolling-area.png) ![glimmer-dsl-libui-mac-dynamic-area-updated.png](images/glimmer-dsl-libui-mac-basic-scrolling-area-scrolled.png)
|
779
|
+
|
780
|
+
Check [examples/basic_scrolling_area.rb](#basic-scrolling-area) for a more detailed example.
|
781
|
+
|
789
782
|
#### Area Path Shapes
|
790
783
|
|
791
784
|
`path` can receive a `draw_fill_mode` argument that can accept values `:winding` or `:alternate` and defaults to `:winding`.
|
@@ -794,26 +787,19 @@ Available nested `path` shapes:
|
|
794
787
|
- `rectangle(x as Numeric, y as Numeric, width as Numeric, height as Numeric)`
|
795
788
|
- `square(x as Numeric, y as Numeric, length as Numeric)`
|
796
789
|
- `arc(x_center as Numeric, y_center as Numeric, radius as Numeric, start_angle as Numeric, sweep as Numeric, is_negative as Boolean)`
|
797
|
-
- `
|
798
|
-
- `
|
799
|
-
- `
|
800
|
-
- `
|
801
|
-
- `
|
790
|
+
- `circle(x_center as Numeric, y_center as Numeric, radius as Numeric)`
|
791
|
+
- `line(x as Numeric, y as Numeric)`: must be placed in a figure (check `polyline`/`polygon` alternatives that do not require a `figure`)
|
792
|
+
- `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)`: must be placed in a figure (check `polybezier` alternative that does not require a `figure`)
|
793
|
+
- `polygon(point_array as Array of Arrays of Numeric or Array of Numeric)`: shortcut for a closed figure of lines; can receive points as [[x1, y1], [x2, y2], ...] or [x1, y1, x2, y2, ...]
|
794
|
+
- `polyline(point_array as Array of Arrays of Numeric or Array of Numeric)`: shortcut for an open figure of lines; can receive points as [[x1, y1], [x2, y2], ...] or [x1, y1, x2, y2, ...]
|
795
|
+
- `polybezier(point_array as Array of Arrays of Numeric or Array of Numeric)`: shortcut for an 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, ...]
|
802
796
|
- `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)
|
803
797
|
|
804
798
|
Check [examples/area_gallery.rb](#area-gallery) for an overiew of all `path` shapes.
|
805
799
|
|
806
|
-
Mac
|
807
|
-
|
808
|
-
![glimmer-dsl-libui-mac-area-gallery.png](images/glimmer-dsl-libui-mac-area-gallery.png)
|
809
|
-
|
810
|
-
Windows
|
811
|
-
|
812
|
-
![glimmer-dsl-libui-windows-area-gallery.png](images/glimmer-dsl-libui-windows-area-gallery.png)
|
813
|
-
|
814
|
-
Linux
|
815
|
-
|
816
|
-
![glimmer-dsl-libui-linux-area-gallery.png](images/glimmer-dsl-libui-linux-area-gallery.png)
|
800
|
+
Mac | Windows | Linux
|
801
|
+
----|---------|------
|
802
|
+
![glimmer-dsl-libui-mac-area-gallery.png](images/glimmer-dsl-libui-mac-area-gallery.png) | ![glimmer-dsl-libui-windows-area-gallery.png](images/glimmer-dsl-libui-windows-area-gallery.png) | ![glimmer-dsl-libui-linux-area-gallery.png](images/glimmer-dsl-libui-linux-area-gallery.png)
|
817
803
|
|
818
804
|
#### Area Text
|
819
805
|
|
@@ -868,26 +854,18 @@ window('area text drawing') {
|
|
868
854
|
|
869
855
|
You may checkout [examples/basic_draw_text.rb](#basic-draw-text) and [examples/custom_draw_text.rb](#custom-draw-text) for examples of using `text` inside `area`.
|
870
856
|
|
871
|
-
Mac
|
872
|
-
|
873
|
-
![glimmer-dsl-libui-mac-custom-draw-text-changed.png](images/glimmer-dsl-libui-mac-custom-draw-text-changed.png)
|
874
|
-
|
875
|
-
Windows
|
876
|
-
|
877
|
-
![glimmer-dsl-libui-windows-custom-draw-text-changed.png](images/glimmer-dsl-libui-windows-custom-draw-text-changed.png)
|
878
|
-
|
879
|
-
Linux
|
880
|
-
|
881
|
-
![glimmer-dsl-libui-linux-custom-draw-text-changed.png](images/glimmer-dsl-libui-linux-custom-draw-text-changed.png)
|
857
|
+
Mac | Windows | Linux
|
858
|
+
----|---------|------
|
859
|
+
![glimmer-dsl-libui-mac-custom-draw-text-changed.png](images/glimmer-dsl-libui-mac-custom-draw-text-changed.png) | ![glimmer-dsl-libui-windows-custom-draw-text-changed.png](images/glimmer-dsl-libui-windows-custom-draw-text-changed.png) | ![glimmer-dsl-libui-linux-custom-draw-text-changed.png](images/glimmer-dsl-libui-linux-custom-draw-text-changed.png)
|
882
860
|
|
883
861
|
#### Area Image
|
884
862
|
|
885
863
|
**(ALPHA FEATURE)**
|
886
864
|
|
887
865
|
[libui](https://github.com/andlabs/libui) does not support `image` rendering outside of `table` yet.
|
888
|
-
However, [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) adds a special `image` custom control that renders an image unto an `area` pixel by pixel (and when possible to optimize, line by line).
|
866
|
+
However, [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) adds a special `image(file as String path or web URL, width as Numeric, height as Numeric)` custom control that renders an image unto an `area` pixel by pixel (and when possible to optimize, line by line).
|
889
867
|
|
890
|
-
Given that it is very new and not a [libui](https://github.com/andlabs/libui)-native control, please keep these notes in mind:
|
868
|
+
Given that it is very new and is not a [libui](https://github.com/andlabs/libui)-native control, please keep these notes in mind:
|
891
869
|
- It only supports the `.png` file format.
|
892
870
|
- [libui](https://github.com/andlabs/libui) pixel-by-pixel rendering performance is slow.
|
893
871
|
- Including an `image` inside an `area` `on_draw` listener improves performance due to not retaining pixel/line data in memory.
|
@@ -895,17 +873,13 @@ Given that it is very new and not a [libui](https://github.com/andlabs/libui)-na
|
|
895
873
|
|
896
874
|
Currently, it is recommended to use `image` with very small `width` and `height` values only.
|
897
875
|
|
898
|
-
Setting a `transform` `matrix` is supported under `image` just like it is under `path` and `text` inside `area`.
|
876
|
+
Setting a [`transform` `matrix`](#area-transform-matrix) is supported under `image` just like it is under `path` and `text` inside `area`.
|
899
877
|
|
900
878
|
Example of using `image` declaratively (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
901
879
|
|
902
|
-
Mac
|
903
|
-
|
904
|
-
![glimmer-dsl-libui-mac-basic-image.png](images/glimmer-dsl-libui-mac-basic-image.png)
|
905
|
-
|
906
|
-
Windows
|
907
|
-
|
908
|
-
![glimmer-dsl-libui-windows-basic-image.png](images/glimmer-dsl-libui-windows-basic-image.png)
|
880
|
+
Mac | Windows | Linux
|
881
|
+
----|---------|------
|
882
|
+
![glimmer-dsl-libui-mac-basic-image.png](images/glimmer-dsl-libui-mac-basic-image.png) | ![glimmer-dsl-libui-windows-basic-image.png](images/glimmer-dsl-libui-windows-basic-image.png) | ![glimmer-dsl-libui-linux-basic-image.png](images/glimmer-dsl-libui-linux-basic-image.png)
|
909
883
|
|
910
884
|
```ruby
|
911
885
|
require 'glimmer-dsl-libui'
|
@@ -1067,7 +1041,7 @@ Check [Histogram](#histogram) example for use of hex colors.
|
|
1067
1041
|
|
1068
1042
|
#### Area Draw Params
|
1069
1043
|
|
1070
|
-
The `area_draw_params` argument for `on_draw` block is a hash consisting of the following keys:
|
1044
|
+
The `area_draw_params` `Hash` argument for `on_draw` block is a hash consisting of the following keys:
|
1071
1045
|
- `:context`: the drawing context object
|
1072
1046
|
- `:area_width`: area width
|
1073
1047
|
- `:area_height`: area height
|
@@ -1223,6 +1197,8 @@ Note that `area`, `path`, and nested shapes are all truly declarative, meaning t
|
|
1223
1197
|
- `image` instances are automatically freed from memory after `window` is destroyed.
|
1224
1198
|
- `image` `width` and `height` can be left off if it has one `image_part` only as they default to the same `width` and `height` of the `image_part`
|
1225
1199
|
- Automatically provide shifted `:key` characters in `area_key_event` provided in `area` key listeners `on_key_event`, `on_key_down`, and `on_key_up`
|
1200
|
+
- `scrolling_area` `width` and `height` default to main window width and height if not specified.
|
1201
|
+
- `scrolling_area` `#scroll_to` 3rd and 4th arguments (`width` and `height`) default to main window width and height if not specified.
|
1226
1202
|
- `area` paths are specified declaratively with figures underneath (e.g. `rectangle`) and `area` draw listener is automatically generated
|
1227
1203
|
- Observe figure properties (e.g. `rectangle` `width`) for changes and automatically redraw containing area accordingly
|
1228
1204
|
- Observe `path` `fill` and `stroke` hashes for changes and automatically redraw containing area accordingly
|
@@ -1372,12 +1348,122 @@ For Linux, simply package your app as a [Ruby Gem](https://guides.rubygems.org/w
|
|
1372
1348
|
|
1373
1349
|
## Glimmer Style Guide
|
1374
1350
|
|
1375
|
-
- Control arguments are always wrapped by parentheses
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1351
|
+
**1 - Control arguments are always wrapped by parentheses.**
|
1352
|
+
|
1353
|
+
Example:
|
1354
|
+
|
1355
|
+
```ruby
|
1356
|
+
label('Name')
|
1357
|
+
```
|
1358
|
+
|
1359
|
+
**2 - Control blocks are always declared with curly braces to clearly visualize hierarchical view code and separate from logic code.**
|
1360
|
+
|
1361
|
+
Example:
|
1362
|
+
|
1363
|
+
```ruby
|
1364
|
+
group('Basic Controls') {
|
1365
|
+
vertical_box {
|
1366
|
+
button('Button') {
|
1367
|
+
}
|
1368
|
+
}
|
1369
|
+
}
|
1370
|
+
```
|
1371
|
+
|
1372
|
+
**3 - Control property declarations always have arguments that are not wrapped inside parentheses and typically do not take a block.**
|
1373
|
+
|
1374
|
+
Example:
|
1375
|
+
|
1376
|
+
```ruby
|
1377
|
+
stretchy false
|
1378
|
+
value 42
|
1379
|
+
```
|
1380
|
+
|
1381
|
+
**4 - Control listeners are always declared starting with on_ prefix and affixing listener event method name afterwards in underscored lowercase form. Their multi-line blocks have a `do; end` style.**
|
1382
|
+
|
1383
|
+
Example:
|
1384
|
+
|
1385
|
+
```ruby
|
1386
|
+
button('Click') {
|
1387
|
+
on_clicked do
|
1388
|
+
msg_box('Information', 'You clicked the button')
|
1389
|
+
end
|
1390
|
+
}
|
1391
|
+
```
|
1392
|
+
|
1393
|
+
**5 - Iterator multi-line blocks always have `do; end` style to clearly separate logic code from view code.**
|
1394
|
+
|
1395
|
+
Example:
|
1396
|
+
|
1397
|
+
```ruby
|
1398
|
+
@field_hash.keys.each do |field|
|
1399
|
+
label(field) {
|
1400
|
+
stretchy false
|
1401
|
+
}
|
1402
|
+
|
1403
|
+
entry {
|
1404
|
+
on_changed do |control|
|
1405
|
+
@field_hash[field] = control.text
|
1406
|
+
end
|
1407
|
+
}
|
1408
|
+
end
|
1409
|
+
```
|
1410
|
+
|
1411
|
+
**6 - In a widget's content block, attributes are declared first, with layout management attributes on top (e.g. `stretchy false`); an empty line separates attributes from nested widgets and listeners following afterwards.**
|
1412
|
+
|
1413
|
+
Example:
|
1414
|
+
|
1415
|
+
```ruby
|
1416
|
+
group('Numbers') {
|
1417
|
+
stretchy false
|
1418
|
+
|
1419
|
+
vertical_box {
|
1420
|
+
spinbox(0, 100) {
|
1421
|
+
stretchy false
|
1422
|
+
value 42
|
1423
|
+
|
1424
|
+
on_changed do |s|
|
1425
|
+
puts "New Spinbox value: #{s.value}"
|
1426
|
+
$stdout.flush # for Windows
|
1427
|
+
end
|
1428
|
+
}
|
1429
|
+
}
|
1430
|
+
}
|
1431
|
+
```
|
1432
|
+
|
1433
|
+
**7 - Unlike attributes, nested widgets with a content block and listeners are always separated from each other by an empty line to make readability easier except where it helps to group two widgets together (e.g. label and described entry).**
|
1434
|
+
|
1435
|
+
Example:
|
1436
|
+
|
1437
|
+
```ruby
|
1438
|
+
area {
|
1439
|
+
path { # needs an empty line afterwards
|
1440
|
+
square(0, 0, 100) # does not have a content block, so no empty line is needed
|
1441
|
+
square(100, 100, 400) # does not have a content block, so no empty line is needed
|
1442
|
+
|
1443
|
+
fill r: 102, g: 102, b: 204
|
1444
|
+
}
|
1445
|
+
|
1446
|
+
path { # needs an empty line afterwards
|
1447
|
+
rectangle(0, 100, 100, 400) # does not have a content block, so no empty line is needed
|
1448
|
+
rectangle(100, 0, 400, 100) # does not have a content block, so no empty line is needed
|
1449
|
+
|
1450
|
+
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}]
|
1451
|
+
}
|
1452
|
+
|
1453
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400) { # needs an empty line afterwards
|
1454
|
+
fill r: 202, g: 102, b: 104, a: 0.5 # attributes do not need an empty line separator
|
1455
|
+
stroke r: 0, g: 0, b: 0 # attributes do not need an empty line separator
|
1456
|
+
}
|
1457
|
+
|
1458
|
+
on_mouse_up do |area_mouse_event| # needs an empty line afterwards
|
1459
|
+
puts 'mouse up'
|
1460
|
+
end
|
1461
|
+
|
1462
|
+
on_key_up do |area_key_event| # needs an empty line afterwards
|
1463
|
+
puts 'key up'
|
1464
|
+
end
|
1465
|
+
}
|
1466
|
+
```
|
1381
1467
|
|
1382
1468
|
## Examples
|
1383
1469
|
|
@@ -1399,17 +1485,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
1399
1485
|
ruby -r glimmer-dsl-libui -e "require 'examples/meta_example'"
|
1400
1486
|
```
|
1401
1487
|
|
1402
|
-
Mac
|
1403
|
-
|
1404
|
-
![glimmer-dsl-libui-mac-meta-example.png](images/glimmer-dsl-libui-mac-meta-example.png)
|
1405
|
-
|
1406
|
-
Windows
|
1407
|
-
|
1408
|
-
![glimmer-dsl-libui-windows-meta-example.png](images/glimmer-dsl-libui-windows-meta-example.png)
|
1409
|
-
|
1410
|
-
Linux
|
1411
|
-
|
1412
|
-
![glimmer-dsl-libui-linux-meta-example.png](images/glimmer-dsl-libui-linux-meta-example.png)
|
1488
|
+
Mac | Windows | Linux
|
1489
|
+
----|---------|------
|
1490
|
+
![glimmer-dsl-libui-mac-meta-example.png](images/glimmer-dsl-libui-mac-meta-example.png) | ![glimmer-dsl-libui-windows-meta-example.png](images/glimmer-dsl-libui-windows-meta-example.png) | ![glimmer-dsl-libui-linux-meta-example.png](images/glimmer-dsl-libui-linux-meta-example.png)
|
1413
1491
|
|
1414
1492
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
1415
1493
|
|
@@ -1567,17 +1645,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
1567
1645
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_window'"
|
1568
1646
|
```
|
1569
1647
|
|
1570
|
-
Mac
|
1571
|
-
|
1572
|
-
![glimmer-dsl-libui-mac-basic-window.png](images/glimmer-dsl-libui-mac-basic-window.png)
|
1573
|
-
|
1574
|
-
Windows
|
1575
|
-
|
1576
|
-
![glimmer-dsl-libui-windows-basic-window.png](images/glimmer-dsl-libui-windows-basic-window.png)
|
1577
|
-
|
1578
|
-
Linux
|
1579
|
-
|
1580
|
-
![glimmer-dsl-libui-linux-basic-window.png](images/glimmer-dsl-libui-linux-basic-window.png)
|
1648
|
+
Mac | Windows | Linux
|
1649
|
+
----|---------|------
|
1650
|
+
![glimmer-dsl-libui-mac-basic-window.png](images/glimmer-dsl-libui-mac-basic-window.png) | ![glimmer-dsl-libui-windows-basic-window.png](images/glimmer-dsl-libui-windows-basic-window.png) | ![glimmer-dsl-libui-linux-basic-window.png](images/glimmer-dsl-libui-linux-basic-window.png)
|
1581
1651
|
|
1582
1652
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
1583
1653
|
|
@@ -1650,20 +1720,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
1650
1720
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_button'"
|
1651
1721
|
```
|
1652
1722
|
|
1653
|
-
Mac
|
1654
|
-
|
1655
|
-
![glimmer-dsl-libui-mac-basic-button.png](images/glimmer-dsl-libui-mac-basic-button.png)
|
1656
|
-
![glimmer-dsl-libui-mac-basic-button-msg-box.png](images/glimmer-dsl-libui-mac-basic-button-msg-box.png)
|
1657
|
-
|
1658
|
-
Windows
|
1659
|
-
|
1660
|
-
![glimmer-dsl-libui-windows-basic-button.png](images/glimmer-dsl-libui-windows-basic-button.png)
|
1661
|
-
![glimmer-dsl-libui-windows-basic-button-msg-box.png](images/glimmer-dsl-libui-windows-basic-button-msg-box.png)
|
1662
|
-
|
1663
|
-
Linux
|
1664
|
-
|
1665
|
-
![glimmer-dsl-libui-linux-basic-button.png](images/glimmer-dsl-libui-linux-basic-button.png)
|
1666
|
-
![glimmer-dsl-libui-linux-basic-button-msg-box.png](images/glimmer-dsl-libui-linux-basic-button-msg-box.png)
|
1723
|
+
Mac | Windows | Linux
|
1724
|
+
----|---------|------
|
1725
|
+
![glimmer-dsl-libui-mac-basic-button.png](images/glimmer-dsl-libui-mac-basic-button.png) ![glimmer-dsl-libui-mac-basic-button-msg-box.png](images/glimmer-dsl-libui-mac-basic-button-msg-box.png) | ![glimmer-dsl-libui-windows-basic-button.png](images/glimmer-dsl-libui-windows-basic-button.png) ![glimmer-dsl-libui-windows-basic-button-msg-box.png](images/glimmer-dsl-libui-windows-basic-button-msg-box.png) | ![glimmer-dsl-libui-linux-basic-button.png](images/glimmer-dsl-libui-linux-basic-button.png) ![glimmer-dsl-libui-linux-basic-button-msg-box.png](images/glimmer-dsl-libui-linux-basic-button-msg-box.png)
|
1667
1726
|
|
1668
1727
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
1669
1728
|
|
@@ -1732,20 +1791,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
1732
1791
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_entry'"
|
1733
1792
|
```
|
1734
1793
|
|
1735
|
-
Mac
|
1736
|
-
|
1737
|
-
![glimmer-dsl-libui-mac-basic-entry.png](images/glimmer-dsl-libui-mac-basic-entry.png)
|
1738
|
-
![glimmer-dsl-libui-mac-basic-entry-msg-box.png](images/glimmer-dsl-libui-mac-basic-entry-msg-box.png)
|
1739
|
-
|
1740
|
-
Windows
|
1741
|
-
|
1742
|
-
![glimmer-dsl-libui-windows-basic-entry.png](images/glimmer-dsl-libui-windows-basic-entry.png)
|
1743
|
-
![glimmer-dsl-libui-windows-basic-entry-msg-box.png](images/glimmer-dsl-libui-windows-basic-entry-msg-box.png)
|
1744
|
-
|
1745
|
-
Linux
|
1746
|
-
|
1747
|
-
![glimmer-dsl-libui-linux-basic-entry.png](images/glimmer-dsl-libui-linux-basic-entry.png)
|
1748
|
-
![glimmer-dsl-libui-linux-basic-entry-msg-box.png](images/glimmer-dsl-libui-linux-basic-entry-msg-box.png)
|
1794
|
+
Mac | Windows | Linux
|
1795
|
+
----|---------|------
|
1796
|
+
![glimmer-dsl-libui-mac-basic-entry.png](images/glimmer-dsl-libui-mac-basic-entry.png) ![glimmer-dsl-libui-mac-basic-entry-msg-box.png](images/glimmer-dsl-libui-mac-basic-entry-msg-box.png) | ![glimmer-dsl-libui-windows-basic-entry.png](images/glimmer-dsl-libui-windows-basic-entry.png) ![glimmer-dsl-libui-windows-basic-entry-msg-box.png](images/glimmer-dsl-libui-windows-basic-entry-msg-box.png) | ![glimmer-dsl-libui-linux-basic-entry.png](images/glimmer-dsl-libui-linux-basic-entry.png) ![glimmer-dsl-libui-linux-basic-entry-msg-box.png](images/glimmer-dsl-libui-linux-basic-entry-msg-box.png)
|
1749
1797
|
|
1750
1798
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
1751
1799
|
|
@@ -1838,17 +1886,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
1838
1886
|
ruby -r glimmer-dsl-libui -e "require 'examples/simple_notepad'"
|
1839
1887
|
```
|
1840
1888
|
|
1841
|
-
Mac
|
1842
|
-
|
1843
|
-
![glimmer-dsl-libui-mac-simple-notepad.png](images/glimmer-dsl-libui-mac-simple-notepad.png)
|
1844
|
-
|
1845
|
-
Windows
|
1846
|
-
|
1847
|
-
![glimmer-dsl-libui-windows-simple-notepad.png](images/glimmer-dsl-libui-windows-simple-notepad.png)
|
1848
|
-
|
1849
|
-
Linux
|
1850
|
-
|
1851
|
-
![glimmer-dsl-libui-linux-simple-notepad.png](images/glimmer-dsl-libui-linux-simple-notepad.png)
|
1889
|
+
Mac | Windows | Linux
|
1890
|
+
----|---------|------
|
1891
|
+
![glimmer-dsl-libui-mac-simple-notepad.png](images/glimmer-dsl-libui-mac-simple-notepad.png) | ![glimmer-dsl-libui-windows-simple-notepad.png](images/glimmer-dsl-libui-windows-simple-notepad.png) | ![glimmer-dsl-libui-linux-simple-notepad.png](images/glimmer-dsl-libui-linux-simple-notepad.png)
|
1852
1892
|
|
1853
1893
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
1854
1894
|
|
@@ -1914,20 +1954,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
1914
1954
|
ruby -r glimmer-dsl-libui -e "require 'examples/midi_player'"
|
1915
1955
|
```
|
1916
1956
|
|
1917
|
-
Mac
|
1918
|
-
|
1919
|
-
![glimmer-dsl-libui-mac-midi-player.png](images/glimmer-dsl-libui-mac-midi-player.png)
|
1920
|
-
![glimmer-dsl-libui-mac-midi-player-msg-box.png](images/glimmer-dsl-libui-mac-midi-player-msg-box.png)
|
1921
|
-
|
1922
|
-
Windows
|
1923
|
-
|
1924
|
-
![glimmer-dsl-libui-windows-midi-player.png](images/glimmer-dsl-libui-windows-midi-player.png)
|
1925
|
-
![glimmer-dsl-libui-windows-midi-player-msg-box.png](images/glimmer-dsl-libui-windows-midi-player-msg-box.png)
|
1926
|
-
|
1927
|
-
Linux
|
1928
|
-
|
1929
|
-
![glimmer-dsl-libui-linux-midi-player.png](images/glimmer-dsl-libui-linux-midi-player.png)
|
1930
|
-
![glimmer-dsl-libui-linux-midi-player-msg-box.png](images/glimmer-dsl-libui-linux-midi-player-msg-box.png)
|
1957
|
+
Mac | Windows | Linux
|
1958
|
+
----|---------|------
|
1959
|
+
![glimmer-dsl-libui-mac-midi-player.png](images/glimmer-dsl-libui-mac-midi-player.png) ![glimmer-dsl-libui-mac-midi-player-msg-box.png](images/glimmer-dsl-libui-mac-midi-player-msg-box.png) | ![glimmer-dsl-libui-windows-midi-player.png](images/glimmer-dsl-libui-windows-midi-player.png) ![glimmer-dsl-libui-windows-midi-player-msg-box.png](images/glimmer-dsl-libui-windows-midi-player-msg-box.png) | ![glimmer-dsl-libui-linux-midi-player.png](images/glimmer-dsl-libui-linux-midi-player.png) ![glimmer-dsl-libui-linux-midi-player-msg-box.png](images/glimmer-dsl-libui-linux-midi-player-msg-box.png)
|
1931
1960
|
|
1932
1961
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
1933
1962
|
|
@@ -1950,12 +1979,8 @@ class TinyMidiPlayer
|
|
1950
1979
|
|
1951
1980
|
def stop_midi
|
1952
1981
|
if @pid
|
1953
|
-
if @th.alive?
|
1954
|
-
|
1955
|
-
@pid = nil
|
1956
|
-
else
|
1957
|
-
@pid = nil
|
1958
|
-
end
|
1982
|
+
Process.kill(:SIGKILL, @pid) if @th.alive?
|
1983
|
+
@pid = nil
|
1959
1984
|
end
|
1960
1985
|
end
|
1961
1986
|
|
@@ -1981,6 +2006,20 @@ class TinyMidiPlayer
|
|
1981
2006
|
end
|
1982
2007
|
|
1983
2008
|
def create_gui
|
2009
|
+
# loop_menu = UI.new_menu('Repeat')
|
2010
|
+
# items = %w[Off One].map do |item_name|
|
2011
|
+
# item = UI.menu_append_check_item(loop_menu, item_name)
|
2012
|
+
# end
|
2013
|
+
# items.each_with_index do |item, idx|
|
2014
|
+
# UI.menu_item_on_clicked(item) do
|
2015
|
+
# @repeat = idx
|
2016
|
+
# (items - [item]).each do |i|
|
2017
|
+
# UI.menu_item_set_checked(i, 0)
|
2018
|
+
# end
|
2019
|
+
# 0
|
2020
|
+
# end
|
2021
|
+
# end
|
2022
|
+
|
1984
2023
|
help_menu = UI.new_menu('Help')
|
1985
2024
|
version_item = UI.menu_append_item(help_menu, 'Version')
|
1986
2025
|
|
@@ -1995,11 +2034,11 @@ class TinyMidiPlayer
|
|
1995
2034
|
|
1996
2035
|
UI.new_horizontal_box.tap do |hbox|
|
1997
2036
|
UI.new_vertical_box.tap do |vbox|
|
1998
|
-
UI.new_button('
|
2037
|
+
UI.new_button('▶').tap do |button1|
|
1999
2038
|
UI.button_on_clicked(button1) { play_midi }
|
2000
2039
|
UI.box_append(vbox, button1, 1)
|
2001
2040
|
end
|
2002
|
-
UI.new_button('
|
2041
|
+
UI.new_button('■').tap do |button2|
|
2003
2042
|
UI.button_on_clicked(button2) { stop_midi }
|
2004
2043
|
UI.box_append(vbox, button2, 1)
|
2005
2044
|
end
|
@@ -2093,12 +2132,12 @@ class TinyMidiPlayer
|
|
2093
2132
|
vertical_box {
|
2094
2133
|
stretchy false
|
2095
2134
|
|
2096
|
-
button('
|
2135
|
+
button('▶') {
|
2097
2136
|
on_clicked do
|
2098
2137
|
play_midi
|
2099
2138
|
end
|
2100
2139
|
}
|
2101
|
-
button('
|
2140
|
+
button('■') {
|
2102
2141
|
on_clicked do
|
2103
2142
|
stop_midi
|
2104
2143
|
end
|
@@ -2137,17 +2176,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
2137
2176
|
ruby -r glimmer-dsl-libui -e "require 'examples/control_gallery'"
|
2138
2177
|
```
|
2139
2178
|
|
2140
|
-
Mac
|
2141
|
-
|
2142
|
-
![glimmer-dsl-libui-mac-control-gallery.png](images/glimmer-dsl-libui-mac-control-gallery.png)
|
2143
|
-
|
2144
|
-
Windows
|
2145
|
-
|
2146
|
-
![glimmer-dsl-libui-windows-control-gallery.png](images/glimmer-dsl-libui-windows-control-gallery.png)
|
2147
|
-
|
2148
|
-
Linux
|
2149
|
-
|
2150
|
-
![glimmer-dsl-libui-linux-control-gallery.png](images/glimmer-dsl-libui-linux-control-gallery.png)
|
2179
|
+
Mac | Windows | Linux
|
2180
|
+
----|---------|------
|
2181
|
+
![glimmer-dsl-libui-mac-control-gallery.png](images/glimmer-dsl-libui-mac-control-gallery.png) | ![glimmer-dsl-libui-windows-control-gallery.png](images/glimmer-dsl-libui-windows-control-gallery.png) | ![glimmer-dsl-libui-linux-control-gallery.png](images/glimmer-dsl-libui-linux-control-gallery.png)
|
2151
2182
|
|
2152
2183
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
2153
2184
|
|
@@ -2531,20 +2562,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
2531
2562
|
ruby -r glimmer-dsl-libui -e "require 'examples/font_button'"
|
2532
2563
|
```
|
2533
2564
|
|
2534
|
-
Mac
|
2535
|
-
|
2536
|
-
![glimmer-dsl-libui-mac-font-button.png](images/glimmer-dsl-libui-mac-font-button.png)
|
2537
|
-
![glimmer-dsl-libui-mac-font-button-selection.png](images/glimmer-dsl-libui-mac-font-button-selection.png)
|
2538
|
-
|
2539
|
-
Windows
|
2540
|
-
|
2541
|
-
![glimmer-dsl-libui-windows-font-button.png](images/glimmer-dsl-libui-windows-font-button.png)
|
2542
|
-
![glimmer-dsl-libui-windows-font-button-selection.png](images/glimmer-dsl-libui-windows-font-button-selection.png)
|
2543
|
-
|
2544
|
-
Linux
|
2545
|
-
|
2546
|
-
![glimmer-dsl-libui-linux-font-button.png](images/glimmer-dsl-libui-linux-font-button.png)
|
2547
|
-
![glimmer-dsl-libui-linux-font-button-selection.png](images/glimmer-dsl-libui-linux-font-button-selection.png)
|
2565
|
+
Mac | Windows | Linux
|
2566
|
+
----|---------|------
|
2567
|
+
![glimmer-dsl-libui-mac-font-button.png](images/glimmer-dsl-libui-mac-font-button.png) ![glimmer-dsl-libui-mac-font-button-selection.png](images/glimmer-dsl-libui-mac-font-button-selection.png) | ![glimmer-dsl-libui-windows-font-button.png](images/glimmer-dsl-libui-windows-font-button.png) ![glimmer-dsl-libui-windows-font-button-selection.png](images/glimmer-dsl-libui-windows-font-button-selection.png) | ![glimmer-dsl-libui-linux-font-button.png](images/glimmer-dsl-libui-linux-font-button.png) ![glimmer-dsl-libui-linux-font-button-selection.png](images/glimmer-dsl-libui-linux-font-button-selection.png)
|
2548
2568
|
|
2549
2569
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
2550
2570
|
|
@@ -2620,20 +2640,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
2620
2640
|
ruby -r glimmer-dsl-libui -e "require 'examples/color_button'"
|
2621
2641
|
```
|
2622
2642
|
|
2623
|
-
Mac
|
2624
|
-
|
2625
|
-
![glimmer-dsl-libui-mac-color-button.png](images/glimmer-dsl-libui-mac-color-button.png)
|
2626
|
-
![glimmer-dsl-libui-mac-color-button-selection.png](images/glimmer-dsl-libui-mac-color-button-selection.png)
|
2627
|
-
|
2628
|
-
Windows
|
2629
|
-
|
2630
|
-
![glimmer-dsl-libui-windows-color-button.png](images/glimmer-dsl-libui-windows-color-button.png)
|
2631
|
-
![glimmer-dsl-libui-windows-color-button-selection.png](images/glimmer-dsl-libui-windows-color-button-selection.png)
|
2632
|
-
|
2633
|
-
Linux
|
2634
|
-
|
2635
|
-
![glimmer-dsl-libui-linux-color-button.png](images/glimmer-dsl-libui-linux-color-button.png)
|
2636
|
-
![glimmer-dsl-libui-linux-color-button-selection.png](images/glimmer-dsl-libui-linux-color-button-selection.png)
|
2643
|
+
Mac | Windows | Linux
|
2644
|
+
----|---------|------
|
2645
|
+
![glimmer-dsl-libui-mac-color-button.png](images/glimmer-dsl-libui-mac-color-button.png) ![glimmer-dsl-libui-mac-color-button-selection.png](images/glimmer-dsl-libui-mac-color-button-selection.png) | ![glimmer-dsl-libui-windows-color-button.png](images/glimmer-dsl-libui-windows-color-button.png) ![glimmer-dsl-libui-windows-color-button-selection.png](images/glimmer-dsl-libui-windows-color-button-selection.png) | ![glimmer-dsl-libui-linux-color-button.png](images/glimmer-dsl-libui-linux-color-button.png) ![glimmer-dsl-libui-linux-color-button-selection.png](images/glimmer-dsl-libui-linux-color-button-selection.png)
|
2637
2646
|
|
2638
2647
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
2639
2648
|
|
@@ -2670,17 +2679,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
2670
2679
|
ruby -r glimmer-dsl-libui -e "require 'examples/date_time_picker'"
|
2671
2680
|
```
|
2672
2681
|
|
2673
|
-
Mac
|
2674
|
-
|
2675
|
-
![glimmer-dsl-libui-mac-date-time-picker.png](images/glimmer-dsl-libui-mac-date-time-picker.png)
|
2676
|
-
|
2677
|
-
Windows
|
2678
|
-
|
2679
|
-
![glimmer-dsl-libui-windows-date-time-picker.png](images/glimmer-dsl-libui-windows-date-time-picker.png)
|
2680
|
-
|
2681
|
-
Linux
|
2682
|
-
|
2683
|
-
![glimmer-dsl-libui-linux-date-time-picker.png](images/glimmer-dsl-libui-linux-date-time-picker.png)
|
2682
|
+
Mac | Windows | Linux
|
2683
|
+
----|---------|------
|
2684
|
+
![glimmer-dsl-libui-mac-date-time-picker.png](images/glimmer-dsl-libui-mac-date-time-picker.png) | ![glimmer-dsl-libui-windows-date-time-picker.png](images/glimmer-dsl-libui-windows-date-time-picker.png) | ![glimmer-dsl-libui-linux-date-time-picker.png](images/glimmer-dsl-libui-linux-date-time-picker.png)
|
2684
2685
|
|
2685
2686
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
2686
2687
|
|
@@ -2764,23 +2765,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
2764
2765
|
ruby -r glimmer-dsl-libui -e "require 'examples/grid'"
|
2765
2766
|
```
|
2766
2767
|
|
2767
|
-
Mac
|
2768
|
-
|
2769
|
-
![glimmer-dsl-libui-mac-grid-span.png](images/glimmer-dsl-libui-mac-grid-span.png)
|
2770
|
-
![glimmer-dsl-libui-mac-grid-expand.png](images/glimmer-dsl-libui-mac-grid-expand.png)
|
2771
|
-
![glimmer-dsl-libui-mac-grid-align.png](images/glimmer-dsl-libui-mac-grid-align.png)
|
2772
|
-
|
2773
|
-
Windows
|
2774
|
-
|
2775
|
-
![glimmer-dsl-libui-windows-grid-span.png](images/glimmer-dsl-libui-windows-grid-span.png)
|
2776
|
-
![glimmer-dsl-libui-windows-grid-expand.png](images/glimmer-dsl-libui-windows-grid-expand.png)
|
2777
|
-
![glimmer-dsl-libui-windows-grid-align.png](images/glimmer-dsl-libui-windows-grid-align.png)
|
2778
|
-
|
2779
|
-
Linux
|
2780
|
-
|
2781
|
-
![glimmer-dsl-libui-linux-grid-span.png](images/glimmer-dsl-libui-linux-grid-span.png)
|
2782
|
-
![glimmer-dsl-libui-linux-grid-expand.png](images/glimmer-dsl-libui-linux-grid-expand.png)
|
2783
|
-
![glimmer-dsl-libui-linux-grid-align.png](images/glimmer-dsl-libui-linux-grid-align.png)
|
2768
|
+
Mac | Windows | Linux
|
2769
|
+
----|---------|------
|
2770
|
+
![glimmer-dsl-libui-mac-grid-span.png](images/glimmer-dsl-libui-mac-grid-span.png) ![glimmer-dsl-libui-mac-grid-expand.png](images/glimmer-dsl-libui-mac-grid-expand.png) ![glimmer-dsl-libui-mac-grid-align.png](images/glimmer-dsl-libui-mac-grid-align.png) | ![glimmer-dsl-libui-windows-grid-span.png](images/glimmer-dsl-libui-windows-grid-span.png) ![glimmer-dsl-libui-windows-grid-expand.png](images/glimmer-dsl-libui-windows-grid-expand.png) ![glimmer-dsl-libui-windows-grid-align.png](images/glimmer-dsl-libui-windows-grid-align.png) | ![glimmer-dsl-libui-linux-grid-span.png](images/glimmer-dsl-libui-linux-grid-span.png) ![glimmer-dsl-libui-linux-grid-expand.png](images/glimmer-dsl-libui-linux-grid-expand.png) ![glimmer-dsl-libui-linux-grid-align.png](images/glimmer-dsl-libui-linux-grid-align.png)
|
2784
2771
|
|
2785
2772
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
2786
2773
|
|
@@ -2793,16 +2780,16 @@ window('Grid') {
|
|
2793
2780
|
tab {
|
2794
2781
|
tab_item('Span') {
|
2795
2782
|
grid {
|
2796
|
-
4.times
|
2797
|
-
4.times
|
2783
|
+
4.times do |top_value|
|
2784
|
+
4.times do |left_value|
|
2798
2785
|
label("(#{left_value}, #{top_value}) xspan1\nyspan1") {
|
2799
2786
|
left left_value
|
2800
2787
|
top top_value
|
2801
2788
|
hexpand true
|
2802
2789
|
vexpand true
|
2803
2790
|
}
|
2804
|
-
|
2805
|
-
|
2791
|
+
end
|
2792
|
+
end
|
2806
2793
|
label("(0, 4) xspan2\nyspan1 more text fits horizontally") {
|
2807
2794
|
left 0
|
2808
2795
|
top 4
|
@@ -2909,20 +2896,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
2909
2896
|
ruby -r glimmer-dsl-libui -e "require 'examples/form'"
|
2910
2897
|
```
|
2911
2898
|
|
2912
|
-
Mac
|
2913
|
-
|
2914
|
-
![glimmer-dsl-libui-mac-form.png](images/glimmer-dsl-libui-mac-form.png)
|
2915
|
-
![glimmer-dsl-libui-mac-form-msg-box.png](images/glimmer-dsl-libui-mac-form-msg-box.png)
|
2916
|
-
|
2917
|
-
Windows
|
2918
|
-
|
2919
|
-
![glimmer-dsl-libui-windows-form.png](images/glimmer-dsl-libui-windows-form.png)
|
2920
|
-
![glimmer-dsl-libui-windows-form-msg-box.png](images/glimmer-dsl-libui-windows-form-msg-box.png)
|
2921
|
-
|
2922
|
-
Linux
|
2923
|
-
|
2924
|
-
![glimmer-dsl-libui-linux-form.png](images/glimmer-dsl-libui-linux-form.png)
|
2925
|
-
![glimmer-dsl-libui-linux-form-msg-box.png](images/glimmer-dsl-libui-linux-form-msg-box.png)
|
2899
|
+
Mac | Windows | Linux
|
2900
|
+
----|---------|------
|
2901
|
+
![glimmer-dsl-libui-mac-form.png](images/glimmer-dsl-libui-mac-form.png) ![glimmer-dsl-libui-mac-form-msg-box.png](images/glimmer-dsl-libui-mac-form-msg-box.png) | ![glimmer-dsl-libui-windows-form.png](images/glimmer-dsl-libui-windows-form.png) ![glimmer-dsl-libui-windows-form-msg-box.png](images/glimmer-dsl-libui-windows-form-msg-box.png) | ![glimmer-dsl-libui-linux-form.png](images/glimmer-dsl-libui-linux-form.png) ![glimmer-dsl-libui-linux-form-msg-box.png](images/glimmer-dsl-libui-linux-form-msg-box.png)
|
2926
2902
|
|
2927
2903
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
2928
2904
|
|
@@ -2980,17 +2956,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
2980
2956
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_table'"
|
2981
2957
|
```
|
2982
2958
|
|
2983
|
-
Mac
|
2984
|
-
|
2985
|
-
![glimmer-dsl-libui-mac-basic-table.png](images/glimmer-dsl-libui-mac-basic-table.png)
|
2986
|
-
|
2987
|
-
Windows
|
2988
|
-
|
2989
|
-
![glimmer-dsl-libui-windows-basic-table.png](images/glimmer-dsl-libui-windows-basic-table.png)
|
2990
|
-
|
2991
|
-
Linux
|
2992
|
-
|
2993
|
-
![glimmer-dsl-libui-linux-basic-table.png](images/glimmer-dsl-libui-linux-basic-table.png)
|
2959
|
+
Mac | Windows | Linux
|
2960
|
+
----|---------|------
|
2961
|
+
![glimmer-dsl-libui-mac-basic-table.png](images/glimmer-dsl-libui-mac-basic-table.png) | ![glimmer-dsl-libui-windows-basic-table.png](images/glimmer-dsl-libui-windows-basic-table.png) | ![glimmer-dsl-libui-linux-basic-table.png](images/glimmer-dsl-libui-linux-basic-table.png)
|
2994
2962
|
|
2995
2963
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
2996
2964
|
|
@@ -3104,23 +3072,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
3104
3072
|
ruby -r glimmer-dsl-libui -e "require 'examples/editable_table'"
|
3105
3073
|
```
|
3106
3074
|
|
3107
|
-
Mac
|
3108
|
-
|
3109
|
-
![glimmer-dsl-libui-mac-editable-table.png](images/glimmer-dsl-libui-mac-editable-table.png)
|
3110
|
-
![glimmer-dsl-libui-mac-editable-table-editing.png](images/glimmer-dsl-libui-mac-editable-table-editing.png)
|
3111
|
-
![glimmer-dsl-libui-mac-editable-table-edited.png](images/glimmer-dsl-libui-mac-editable-table-edited.png)
|
3112
|
-
|
3113
|
-
Windows
|
3114
|
-
|
3115
|
-
![glimmer-dsl-libui-windows-editable-table.png](images/glimmer-dsl-libui-windows-editable-table.png)
|
3116
|
-
![glimmer-dsl-libui-windows-editable-table-editing.png](images/glimmer-dsl-libui-windows-editable-table-editing.png)
|
3117
|
-
![glimmer-dsl-libui-windows-editable-table-edited.png](images/glimmer-dsl-libui-windows-editable-table-edited.png)
|
3118
|
-
|
3119
|
-
Linux
|
3120
|
-
|
3121
|
-
![glimmer-dsl-libui-linux-editable-table.png](images/glimmer-dsl-libui-linux-editable-table.png)
|
3122
|
-
![glimmer-dsl-libui-linux-editable-table-editing.png](images/glimmer-dsl-libui-linux-editable-table-editing.png)
|
3123
|
-
![glimmer-dsl-libui-linux-editable-table-edited.png](images/glimmer-dsl-libui-linux-editable-table-edited.png)
|
3075
|
+
Mac | Windows | Linux
|
3076
|
+
----|---------|------
|
3077
|
+
![glimmer-dsl-libui-mac-editable-table.png](images/glimmer-dsl-libui-mac-editable-table.png) ![glimmer-dsl-libui-mac-editable-table-editing.png](images/glimmer-dsl-libui-mac-editable-table-editing.png) ![glimmer-dsl-libui-mac-editable-table-edited.png](images/glimmer-dsl-libui-mac-editable-table-edited.png) | ![glimmer-dsl-libui-windows-editable-table.png](images/glimmer-dsl-libui-windows-editable-table.png) ![glimmer-dsl-libui-windows-editable-table-editing.png](images/glimmer-dsl-libui-windows-editable-table-editing.png) ![glimmer-dsl-libui-windows-editable-table-edited.png](images/glimmer-dsl-libui-windows-editable-table-edited.png) | ![glimmer-dsl-libui-linux-editable-table.png](images/glimmer-dsl-libui-linux-editable-table.png) ![glimmer-dsl-libui-linux-editable-table-editing.png](images/glimmer-dsl-libui-linux-editable-table-editing.png) ![glimmer-dsl-libui-linux-editable-table-edited.png](images/glimmer-dsl-libui-linux-editable-table-edited.png)
|
3124
3078
|
|
3125
3079
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
3126
3080
|
|
@@ -3178,20 +3132,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
3178
3132
|
ruby -r glimmer-dsl-libui -e "require 'examples/editable_column_table'"
|
3179
3133
|
```
|
3180
3134
|
|
3181
|
-
Mac
|
3182
|
-
|
3183
|
-
![glimmer-dsl-libui-mac-editable-column-table-editing.png](images/glimmer-dsl-libui-mac-editable-column-table-editing.png)
|
3184
|
-
![glimmer-dsl-libui-mac-editable-column-table-edited.png](images/glimmer-dsl-libui-mac-editable-column-table-edited.png)
|
3185
|
-
|
3186
|
-
Windows
|
3187
|
-
|
3188
|
-
![glimmer-dsl-libui-windows-editable-column-table-editing.png](images/glimmer-dsl-libui-windows-editable-column-table-editing.png)
|
3189
|
-
![glimmer-dsl-libui-windows-editable-column-table-edited.png](images/glimmer-dsl-libui-windows-editable-column-table-edited.png)
|
3190
|
-
|
3191
|
-
Linux
|
3192
|
-
|
3193
|
-
![glimmer-dsl-libui-linux-editable-column-table-editing.png](images/glimmer-dsl-libui-linux-editable-column-table-editing.png)
|
3194
|
-
![glimmer-dsl-libui-linux-editable-column-table-edited.png](images/glimmer-dsl-libui-linux-editable-column-table-edited.png)
|
3135
|
+
Mac | Windows | Linux
|
3136
|
+
----|---------|------
|
3137
|
+
![glimmer-dsl-libui-mac-editable-column-table-editing.png](images/glimmer-dsl-libui-mac-editable-column-table-editing.png) ![glimmer-dsl-libui-mac-editable-column-table-edited.png](images/glimmer-dsl-libui-mac-editable-column-table-edited.png) | ![glimmer-dsl-libui-windows-editable-column-table-editing.png](images/glimmer-dsl-libui-windows-editable-column-table-editing.png) ![glimmer-dsl-libui-windows-editable-column-table-edited.png](images/glimmer-dsl-libui-windows-editable-column-table-edited.png) | ![glimmer-dsl-libui-linux-editable-column-table-editing.png](images/glimmer-dsl-libui-linux-editable-column-table-editing.png) ![glimmer-dsl-libui-linux-editable-column-table-edited.png](images/glimmer-dsl-libui-linux-editable-column-table-edited.png)
|
3195
3138
|
|
3196
3139
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
3197
3140
|
|
@@ -3245,17 +3188,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
3245
3188
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_table_image'"
|
3246
3189
|
```
|
3247
3190
|
|
3248
|
-
Mac
|
3249
|
-
|
3250
|
-
![glimmer-dsl-libui-mac-basic-table-image.png](images/glimmer-dsl-libui-mac-basic-table-image.png)
|
3251
|
-
|
3252
|
-
Windows
|
3253
|
-
|
3254
|
-
![glimmer-dsl-libui-windows-basic-table-image.png](images/glimmer-dsl-libui-windows-basic-table-image.png)
|
3255
|
-
|
3256
|
-
Linux
|
3257
|
-
|
3258
|
-
![glimmer-dsl-libui-linux-basic-table-image.png](images/glimmer-dsl-libui-linux-basic-table-image.png)
|
3191
|
+
Mac | Windows | Linux
|
3192
|
+
----|---------|------
|
3193
|
+
![glimmer-dsl-libui-mac-basic-table-image.png](images/glimmer-dsl-libui-mac-basic-table-image.png) | ![glimmer-dsl-libui-windows-basic-table-image.png](images/glimmer-dsl-libui-windows-basic-table-image.png) | ![glimmer-dsl-libui-linux-basic-table-image.png](images/glimmer-dsl-libui-linux-basic-table-image.png)
|
3259
3194
|
|
3260
3195
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
3261
3196
|
|
@@ -3436,17 +3371,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
3436
3371
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_table_image_text'"
|
3437
3372
|
```
|
3438
3373
|
|
3439
|
-
Mac
|
3440
|
-
|
3441
|
-
![glimmer-dsl-libui-mac-basic-table-image-text.png](images/glimmer-dsl-libui-mac-basic-table-image-text.png)
|
3442
|
-
|
3443
|
-
Windows
|
3444
|
-
|
3445
|
-
![glimmer-dsl-libui-windows-basic-table-image-text.png](images/glimmer-dsl-libui-windows-basic-table-image-text.png)
|
3446
|
-
|
3447
|
-
Linux
|
3448
|
-
|
3449
|
-
![glimmer-dsl-libui-linux-basic-table-image-text.png](images/glimmer-dsl-libui-linux-basic-table-image-text.png)
|
3374
|
+
Mac | Windows | Linux
|
3375
|
+
----|---------|------
|
3376
|
+
![glimmer-dsl-libui-mac-basic-table-image-text.png](images/glimmer-dsl-libui-mac-basic-table-image-text.png) | ![glimmer-dsl-libui-windows-basic-table-image-text.png](images/glimmer-dsl-libui-windows-basic-table-image-text.png) | ![glimmer-dsl-libui-linux-basic-table-image-text.png](images/glimmer-dsl-libui-linux-basic-table-image-text.png)
|
3450
3377
|
|
3451
3378
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
3452
3379
|
|
@@ -3546,20 +3473,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
3546
3473
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_table_button'"
|
3547
3474
|
```
|
3548
3475
|
|
3549
|
-
Mac
|
3550
|
-
|
3551
|
-
![glimmer-dsl-libui-mac-basic-table-button.png](images/glimmer-dsl-libui-mac-basic-table-button.png)
|
3552
|
-
![glimmer-dsl-libui-mac-basic-table-button-deleted.png](images/glimmer-dsl-libui-mac-basic-table-button-deleted.png)
|
3553
|
-
|
3554
|
-
Windows
|
3555
|
-
|
3556
|
-
![glimmer-dsl-libui-windows-basic-table-button.png](images/glimmer-dsl-libui-windows-basic-table-button.png)
|
3557
|
-
![glimmer-dsl-libui-windows-basic-table-button-deleted.png](images/glimmer-dsl-libui-windows-basic-table-button-deleted.png)
|
3558
|
-
|
3559
|
-
Linux
|
3560
|
-
|
3561
|
-
![glimmer-dsl-libui-linux-basic-table-button.png](images/glimmer-dsl-libui-linux-basic-table-button.png)
|
3562
|
-
![glimmer-dsl-libui-linux-basic-table-button-deleted.png](images/glimmer-dsl-libui-linux-basic-table-button-deleted.png)
|
3476
|
+
Mac | Windows | Linux
|
3477
|
+
----|---------|------
|
3478
|
+
![glimmer-dsl-libui-mac-basic-table-button.png](images/glimmer-dsl-libui-mac-basic-table-button.png) ![glimmer-dsl-libui-mac-basic-table-button-deleted.png](images/glimmer-dsl-libui-mac-basic-table-button-deleted.png) | ![glimmer-dsl-libui-windows-basic-table-button.png](images/glimmer-dsl-libui-windows-basic-table-button.png) ![glimmer-dsl-libui-windows-basic-table-button-deleted.png](images/glimmer-dsl-libui-windows-basic-table-button-deleted.png) | ![glimmer-dsl-libui-linux-basic-table-button.png](images/glimmer-dsl-libui-linux-basic-table-button.png) ![glimmer-dsl-libui-linux-basic-table-button-deleted.png](images/glimmer-dsl-libui-linux-basic-table-button-deleted.png)
|
3563
3479
|
|
3564
3480
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
3565
3481
|
|
@@ -3613,17 +3529,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
3613
3529
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_table_checkbox'"
|
3614
3530
|
```
|
3615
3531
|
|
3616
|
-
Mac
|
3617
|
-
|
3618
|
-
![glimmer-dsl-libui-mac-basic-table-checkbox.png](images/glimmer-dsl-libui-mac-basic-table-checkbox.png)
|
3619
|
-
|
3620
|
-
Windows
|
3621
|
-
|
3622
|
-
![glimmer-dsl-libui-windows-basic-table-checkbox.png](images/glimmer-dsl-libui-windows-basic-table-checkbox.png)
|
3623
|
-
|
3624
|
-
Linux
|
3625
|
-
|
3626
|
-
![glimmer-dsl-libui-linux-basic-table-checkbox.png](images/glimmer-dsl-libui-linux-basic-table-checkbox.png)
|
3532
|
+
Mac | Windows | Linux
|
3533
|
+
----|---------|------
|
3534
|
+
![glimmer-dsl-libui-mac-basic-table-checkbox.png](images/glimmer-dsl-libui-mac-basic-table-checkbox.png) | ![glimmer-dsl-libui-windows-basic-table-checkbox.png](images/glimmer-dsl-libui-windows-basic-table-checkbox.png) | ![glimmer-dsl-libui-linux-basic-table-checkbox.png](images/glimmer-dsl-libui-linux-basic-table-checkbox.png)
|
3627
3535
|
|
3628
3536
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
3629
3537
|
|
@@ -3669,22 +3577,14 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
3669
3577
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_table_checkbox_text'"
|
3670
3578
|
```
|
3671
3579
|
|
3672
|
-
Mac
|
3580
|
+
Mac | Windows | Linux
|
3581
|
+
----|---------|------
|
3582
|
+
![glimmer-dsl-libui-mac-basic-table-checkbox-text.png](images/glimmer-dsl-libui-mac-basic-table-checkbox-text.png) | ![glimmer-dsl-libui-windows-basic-table-checkbox-text.png](images/glimmer-dsl-libui-windows-basic-table-checkbox-text.png) | ![glimmer-dsl-libui-linux-basic-table-checkbox-text.png](images/glimmer-dsl-libui-linux-basic-table-checkbox-text.png)
|
3673
3583
|
|
3674
|
-
|
3584
|
+
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
3675
3585
|
|
3676
|
-
|
3677
|
-
|
3678
|
-
![glimmer-dsl-libui-windows-basic-table-checkbox-text.png](images/glimmer-dsl-libui-windows-basic-table-checkbox-text.png)
|
3679
|
-
|
3680
|
-
Linux
|
3681
|
-
|
3682
|
-
![glimmer-dsl-libui-linux-basic-table-checkbox-text.png](images/glimmer-dsl-libui-linux-basic-table-checkbox-text.png)
|
3683
|
-
|
3684
|
-
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
3685
|
-
|
3686
|
-
```ruby
|
3687
|
-
require 'glimmer-dsl-libui'
|
3586
|
+
```ruby
|
3587
|
+
require 'glimmer-dsl-libui'
|
3688
3588
|
|
3689
3589
|
include Glimmer
|
3690
3590
|
|
@@ -3725,17 +3625,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
3725
3625
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_table_progress_bar'"
|
3726
3626
|
```
|
3727
3627
|
|
3728
|
-
Mac
|
3729
|
-
|
3730
|
-
![glimmer-dsl-libui-mac-basic-table-progress-bar.png](images/glimmer-dsl-libui-mac-basic-table-progress-bar.png)
|
3731
|
-
|
3732
|
-
Windows
|
3733
|
-
|
3734
|
-
![glimmer-dsl-libui-windows-basic-table-progress-bar.png](images/glimmer-dsl-libui-windows-basic-table-progress-bar.png)
|
3735
|
-
|
3736
|
-
Linux
|
3737
|
-
|
3738
|
-
![glimmer-dsl-libui-linux-basic-table-progress-bar.png](images/glimmer-dsl-libui-linux-basic-table-progress-bar.png)
|
3628
|
+
Mac | Windows | Linux
|
3629
|
+
----|---------|------
|
3630
|
+
![glimmer-dsl-libui-mac-basic-table-progress-bar.png](images/glimmer-dsl-libui-mac-basic-table-progress-bar.png) | ![glimmer-dsl-libui-windows-basic-table-progress-bar.png](images/glimmer-dsl-libui-windows-basic-table-progress-bar.png) | ![glimmer-dsl-libui-linux-basic-table-progress-bar.png](images/glimmer-dsl-libui-linux-basic-table-progress-bar.png)
|
3739
3631
|
|
3740
3632
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
3741
3633
|
|
@@ -3790,17 +3682,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
3790
3682
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_table_color'"
|
3791
3683
|
```
|
3792
3684
|
|
3793
|
-
Mac
|
3794
|
-
|
3795
|
-
![glimmer-dsl-libui-mac-basic-table-color.png](images/glimmer-dsl-libui-mac-basic-table-color.png)
|
3796
|
-
|
3797
|
-
Windows
|
3798
|
-
|
3799
|
-
![glimmer-dsl-libui-windows-basic-table-color.png](images/glimmer-dsl-libui-windows-basic-table-color.png)
|
3800
|
-
|
3801
|
-
Linux
|
3802
|
-
|
3803
|
-
![glimmer-dsl-libui-linux-basic-table-color.png](images/glimmer-dsl-libui-linux-basic-table-color.png)
|
3685
|
+
Mac | Windows | Linux
|
3686
|
+
----|---------|------
|
3687
|
+
![glimmer-dsl-libui-mac-basic-table-color.png](images/glimmer-dsl-libui-mac-basic-table-color.png) | ![glimmer-dsl-libui-windows-basic-table-color.png](images/glimmer-dsl-libui-windows-basic-table-color.png) | ![glimmer-dsl-libui-linux-basic-table-color.png](images/glimmer-dsl-libui-linux-basic-table-color.png)
|
3804
3688
|
|
3805
3689
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
3806
3690
|
|
@@ -3894,23 +3778,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
3894
3778
|
ruby -r glimmer-dsl-libui -e "require 'examples/form_table'"
|
3895
3779
|
```
|
3896
3780
|
|
3897
|
-
Mac
|
3898
|
-
|
3899
|
-
![glimmer-dsl-libui-mac-form-table.png](images/glimmer-dsl-libui-mac-form-table.png)
|
3900
|
-
![glimmer-dsl-libui-mac-form-table-contact-entered.png](images/glimmer-dsl-libui-mac-form-table-contact-entered.png)
|
3901
|
-
![glimmer-dsl-libui-mac-form-table-filtered.png](images/glimmer-dsl-libui-mac-form-table-filtered.png)
|
3902
|
-
|
3903
|
-
Windows
|
3904
|
-
|
3905
|
-
![glimmer-dsl-libui-windows-form-table.png](images/glimmer-dsl-libui-windows-form-table.png)
|
3906
|
-
![glimmer-dsl-libui-windows-form-table-contact-entered.png](images/glimmer-dsl-libui-windows-form-table-contact-entered.png)
|
3907
|
-
![glimmer-dsl-libui-windows-form-table-filtered.png](images/glimmer-dsl-libui-windows-form-table-filtered.png)
|
3908
|
-
|
3909
|
-
Linux
|
3910
|
-
|
3911
|
-
![glimmer-dsl-libui-linux-form-table.png](images/glimmer-dsl-libui-linux-form-table.png)
|
3912
|
-
![glimmer-dsl-libui-linux-form-table-contact-entered.png](images/glimmer-dsl-libui-linux-form-table-contact-entered.png)
|
3913
|
-
![glimmer-dsl-libui-linux-form-table-filtered.png](images/glimmer-dsl-libui-linux-form-table-filtered.png)
|
3781
|
+
Mac | Windows | Linux
|
3782
|
+
----|---------|------
|
3783
|
+
![glimmer-dsl-libui-mac-form-table.png](images/glimmer-dsl-libui-mac-form-table.png) ![glimmer-dsl-libui-mac-form-table-contact-entered.png](images/glimmer-dsl-libui-mac-form-table-contact-entered.png) ![glimmer-dsl-libui-mac-form-table-filtered.png](images/glimmer-dsl-libui-mac-form-table-filtered.png) | ![glimmer-dsl-libui-windows-form-table.png](images/glimmer-dsl-libui-windows-form-table.png) ![glimmer-dsl-libui-windows-form-table-contact-entered.png](images/glimmer-dsl-libui-windows-form-table-contact-entered.png) ![glimmer-dsl-libui-windows-form-table-filtered.png](images/glimmer-dsl-libui-windows-form-table-filtered.png) | ![glimmer-dsl-libui-linux-form-table.png](images/glimmer-dsl-libui-linux-form-table.png) ![glimmer-dsl-libui-linux-form-table-contact-entered.png](images/glimmer-dsl-libui-linux-form-table-contact-entered.png) ![glimmer-dsl-libui-linux-form-table-filtered.png](images/glimmer-dsl-libui-linux-form-table-filtered.png)
|
3914
3784
|
|
3915
3785
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
3916
3786
|
|
@@ -3937,15 +3807,19 @@ window('Contacts', 600, 600) { |w|
|
|
3937
3807
|
@name_entry = entry {
|
3938
3808
|
label 'Name'
|
3939
3809
|
}
|
3810
|
+
|
3940
3811
|
@email_entry = entry {
|
3941
3812
|
label 'Email'
|
3942
3813
|
}
|
3814
|
+
|
3943
3815
|
@phone_entry = entry {
|
3944
3816
|
label 'Phone'
|
3945
3817
|
}
|
3818
|
+
|
3946
3819
|
@city_entry = entry {
|
3947
3820
|
label 'City'
|
3948
3821
|
}
|
3822
|
+
|
3949
3823
|
@state_entry = entry {
|
3950
3824
|
label 'State'
|
3951
3825
|
}
|
@@ -4022,17 +3896,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
4022
3896
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_area'"
|
4023
3897
|
```
|
4024
3898
|
|
4025
|
-
Mac
|
4026
|
-
|
4027
|
-
![glimmer-dsl-libui-mac-basic-area.png](images/glimmer-dsl-libui-mac-basic-area.png)
|
4028
|
-
|
4029
|
-
Windows
|
4030
|
-
|
4031
|
-
![glimmer-dsl-libui-windows-basic-area.png](images/glimmer-dsl-libui-windows-basic-area.png)
|
4032
|
-
|
4033
|
-
Linux
|
4034
|
-
|
4035
|
-
![glimmer-dsl-libui-linux-basic-area.png](images/glimmer-dsl-libui-linux-basic-area.png)
|
3899
|
+
Mac | Windows | Linux
|
3900
|
+
----|---------|------
|
3901
|
+
![glimmer-dsl-libui-mac-basic-area.png](images/glimmer-dsl-libui-mac-basic-area.png) | ![glimmer-dsl-libui-windows-basic-area.png](images/glimmer-dsl-libui-windows-basic-area.png) | ![glimmer-dsl-libui-linux-basic-area.png](images/glimmer-dsl-libui-linux-basic-area.png)
|
4036
3902
|
|
4037
3903
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
4038
3904
|
|
@@ -4148,20 +4014,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
4148
4014
|
ruby -r glimmer-dsl-libui -e "require 'examples/dynamic_area'"
|
4149
4015
|
```
|
4150
4016
|
|
4151
|
-
Mac
|
4152
|
-
|
4153
|
-
![glimmer-dsl-libui-mac-dynamic-area.png](images/glimmer-dsl-libui-mac-dynamic-area.png)
|
4154
|
-
![glimmer-dsl-libui-mac-dynamic-area-updated.png](images/glimmer-dsl-libui-mac-dynamic-area-updated.png)
|
4155
|
-
|
4156
|
-
Windows
|
4157
|
-
|
4158
|
-
![glimmer-dsl-libui-windows-dynamic-area.png](images/glimmer-dsl-libui-windows-dynamic-area.png)
|
4159
|
-
![glimmer-dsl-libui-windows-dynamic-area-updated.png](images/glimmer-dsl-libui-windows-dynamic-area-updated.png)
|
4160
|
-
|
4161
|
-
Linux
|
4162
|
-
|
4163
|
-
![glimmer-dsl-libui-linux-dynamic-area.png](images/glimmer-dsl-libui-linux-dynamic-area.png)
|
4164
|
-
![glimmer-dsl-libui-linux-dynamic-area-updated.png](images/glimmer-dsl-libui-linux-dynamic-area-updated.png)
|
4017
|
+
Mac | Windows | Linux
|
4018
|
+
----|---------|------
|
4019
|
+
![glimmer-dsl-libui-mac-dynamic-area.png](images/glimmer-dsl-libui-mac-dynamic-area.png) ![glimmer-dsl-libui-mac-dynamic-area-updated.png](images/glimmer-dsl-libui-mac-dynamic-area-updated.png) | ![glimmer-dsl-libui-windows-dynamic-area.png](images/glimmer-dsl-libui-windows-dynamic-area.png) ![glimmer-dsl-libui-windows-dynamic-area-updated.png](images/glimmer-dsl-libui-windows-dynamic-area-updated.png) | ![glimmer-dsl-libui-linux-dynamic-area.png](images/glimmer-dsl-libui-linux-dynamic-area.png) ![glimmer-dsl-libui-linux-dynamic-area-updated.png](images/glimmer-dsl-libui-linux-dynamic-area-updated.png)
|
4165
4020
|
|
4166
4021
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
4167
4022
|
|
@@ -4170,7 +4025,7 @@ require 'glimmer-dsl-libui'
|
|
4170
4025
|
|
4171
4026
|
include Glimmer
|
4172
4027
|
|
4173
|
-
window('Dynamic Area', 240,
|
4028
|
+
window('Dynamic Area', 240, 600) {
|
4174
4029
|
margined true
|
4175
4030
|
|
4176
4031
|
vertical_box {
|
@@ -4256,9 +4111,7 @@ window('Dynamic Area', 240, 500) {
|
|
4256
4111
|
|
4257
4112
|
@area = area {
|
4258
4113
|
on_draw do |area_draw_params|
|
4259
|
-
|
4260
|
-
rectangle(@x_spinbox.value, @y_spinbox.value, @width_spinbox.value, @height_spinbox.value)
|
4261
|
-
|
4114
|
+
rectangle(@x_spinbox.value, @y_spinbox.value, @width_spinbox.value, @height_spinbox.value) { # a dynamic path is added semi-declaratively inside on_draw block
|
4262
4115
|
fill r: @red_spinbox.value, g: @green_spinbox.value, b: @blue_spinbox.value, a: @alpha_spinbox.value / 100.0
|
4263
4116
|
}
|
4264
4117
|
end
|
@@ -4326,7 +4179,7 @@ window('Dynamic Area', 240, 600) {
|
|
4326
4179
|
value 102
|
4327
4180
|
|
4328
4181
|
on_changed do
|
4329
|
-
@
|
4182
|
+
@rectangle.fill[:r] = @red_spinbox.value # updating hash properties automatically triggers area.queue_redraw_all
|
4330
4183
|
end
|
4331
4184
|
}
|
4332
4185
|
|
@@ -4335,7 +4188,7 @@ window('Dynamic Area', 240, 600) {
|
|
4335
4188
|
value 102
|
4336
4189
|
|
4337
4190
|
on_changed do
|
4338
|
-
@
|
4191
|
+
@rectangle.fill[:g] = @green_spinbox.value # updating hash properties automatically triggers area.queue_redraw_all
|
4339
4192
|
end
|
4340
4193
|
}
|
4341
4194
|
|
@@ -4344,7 +4197,7 @@ window('Dynamic Area', 240, 600) {
|
|
4344
4197
|
value 204
|
4345
4198
|
|
4346
4199
|
on_changed do
|
4347
|
-
@
|
4200
|
+
@rectangle.fill[:b] = @blue_spinbox.value # updating hash properties automatically triggers area.queue_redraw_all
|
4348
4201
|
end
|
4349
4202
|
}
|
4350
4203
|
|
@@ -4353,15 +4206,13 @@ window('Dynamic Area', 240, 600) {
|
|
4353
4206
|
value 100
|
4354
4207
|
|
4355
4208
|
on_changed do
|
4356
|
-
@
|
4209
|
+
@rectangle.fill[:a] = @alpha_spinbox.value / 100.0 # updating hash properties automatically triggers area.queue_redraw_all
|
4357
4210
|
end
|
4358
4211
|
}
|
4359
4212
|
}
|
4360
4213
|
|
4361
4214
|
area {
|
4362
|
-
@
|
4363
|
-
@rectangle = rectangle(@x_spinbox.value, @y_spinbox.value, @width_spinbox.value, @height_spinbox.value)
|
4364
|
-
|
4215
|
+
@rectangle = rectangle(@x_spinbox.value, @y_spinbox.value, @width_spinbox.value, @height_spinbox.value) { # stable path
|
4365
4216
|
fill r: @red_spinbox.value, g: @green_spinbox.value, b: @blue_spinbox.value, a: @alpha_spinbox.value / 100.0
|
4366
4217
|
}
|
4367
4218
|
}
|
@@ -4369,33 +4220,128 @@ window('Dynamic Area', 240, 600) {
|
|
4369
4220
|
}.show
|
4370
4221
|
```
|
4371
4222
|
|
4372
|
-
### Area
|
4223
|
+
### Basic Scrolling Area
|
4373
4224
|
|
4374
|
-
[examples/
|
4225
|
+
[examples/basic_scrolling_area.rb](examples/basic_scrolling_area.rb)
|
4375
4226
|
|
4376
4227
|
Run with this command from the root of the project if you cloned the project:
|
4377
4228
|
|
4378
4229
|
```
|
4379
|
-
ruby -r './lib/glimmer-dsl-libui' examples/
|
4230
|
+
ruby -r './lib/glimmer-dsl-libui' examples/basic_scrolling_area.rb
|
4380
4231
|
```
|
4381
4232
|
|
4382
4233
|
Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
|
4383
4234
|
|
4384
4235
|
```
|
4385
|
-
ruby -r glimmer-dsl-libui -e "require 'examples/
|
4236
|
+
ruby -r glimmer-dsl-libui -e "require 'examples/basic_scrolling_area'"
|
4237
|
+
```
|
4238
|
+
|
4239
|
+
Mac |
|
4240
|
+
----|
|
4241
|
+
![glimmer-dsl-libui-mac-dynamic-area.png](images/glimmer-dsl-libui-mac-basic-scrolling-area.png) ![glimmer-dsl-libui-mac-dynamic-area-updated.png](images/glimmer-dsl-libui-mac-basic-scrolling-area-scrolled.png)
|
4242
|
+
|
4243
|
+
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
4244
|
+
|
4245
|
+
```ruby
|
4246
|
+
require 'glimmer-dsl-libui'
|
4247
|
+
|
4248
|
+
class BasicScrollingArea
|
4249
|
+
include Glimmer
|
4250
|
+
|
4251
|
+
SCROLLING_AREA_WIDTH = 800
|
4252
|
+
SCROLLING_AREA_HEIGHT = 400
|
4253
|
+
SCROLLING_AREA_PADDING_X = 20
|
4254
|
+
SCROLLING_AREA_PADDING_Y = 20
|
4255
|
+
|
4256
|
+
def initialize
|
4257
|
+
@x = SCROLLING_AREA_PADDING_X
|
4258
|
+
@y = SCROLLING_AREA_HEIGHT - SCROLLING_AREA_PADDING_Y
|
4259
|
+
create_gui
|
4260
|
+
Glimmer::LibUI.timer(0.01) do
|
4261
|
+
@x += SCROLLING_AREA_PADDING_X
|
4262
|
+
@y = [[@y + rand(SCROLLING_AREA_PADDING_Y*4)*(rand(2) == 0 ? -1 : 1), SCROLLING_AREA_PADDING_Y].max, SCROLLING_AREA_HEIGHT - SCROLLING_AREA_PADDING_Y].min
|
4263
|
+
@graph.content { # re-open @graph's content and add a line
|
4264
|
+
line(@x, @y)
|
4265
|
+
}
|
4266
|
+
# if there is a need to enlarge scrolling area, call `@scrolling_area.set_size(new_width, new_height)`
|
4267
|
+
@scrolling_area.scroll_to(@x - (SCROLLING_AREA_WIDTH/2), @y) # 3rd and 4th arguments for width and height are assumed as those of main window by default if not supplied
|
4268
|
+
# return false to stop timer once @x exceeds scrolling area width - padding
|
4269
|
+
false if @x >= (SCROLLING_AREA_WIDTH - SCROLLING_AREA_PADDING_X*2)
|
4270
|
+
end
|
4271
|
+
end
|
4272
|
+
|
4273
|
+
def launch
|
4274
|
+
@main_window.show
|
4275
|
+
end
|
4276
|
+
|
4277
|
+
def x_axis
|
4278
|
+
polyline(SCROLLING_AREA_PADDING_X, SCROLLING_AREA_HEIGHT - SCROLLING_AREA_PADDING_Y, SCROLLING_AREA_WIDTH - SCROLLING_AREA_PADDING_X*2, SCROLLING_AREA_HEIGHT - SCROLLING_AREA_PADDING_Y) {
|
4279
|
+
stroke :black, thickness: 3
|
4280
|
+
}
|
4281
|
+
|
4282
|
+
((SCROLLING_AREA_WIDTH - SCROLLING_AREA_PADDING_X*4) / SCROLLING_AREA_PADDING_X).times do |x_multiplier|
|
4283
|
+
x = x_multiplier*SCROLLING_AREA_PADDING_X + SCROLLING_AREA_PADDING_X*2
|
4284
|
+
y = SCROLLING_AREA_HEIGHT - SCROLLING_AREA_PADDING_Y
|
4285
|
+
|
4286
|
+
polyline(x, y, x, y + SCROLLING_AREA_PADDING_Y/2) {
|
4287
|
+
stroke :black, thickness: 2
|
4288
|
+
}
|
4289
|
+
end
|
4290
|
+
end
|
4291
|
+
|
4292
|
+
def y_axis
|
4293
|
+
polyline(SCROLLING_AREA_PADDING_X, SCROLLING_AREA_PADDING_Y, SCROLLING_AREA_PADDING_X, SCROLLING_AREA_HEIGHT - SCROLLING_AREA_PADDING_Y) {
|
4294
|
+
stroke :black, thickness: 3
|
4295
|
+
}
|
4296
|
+
|
4297
|
+
((SCROLLING_AREA_HEIGHT - SCROLLING_AREA_PADDING_Y*3) / SCROLLING_AREA_PADDING_Y).times do |y_multiplier|
|
4298
|
+
x = SCROLLING_AREA_PADDING_X
|
4299
|
+
y = y_multiplier*SCROLLING_AREA_PADDING_Y + SCROLLING_AREA_PADDING_Y*2
|
4300
|
+
|
4301
|
+
polyline(x, y, x - SCROLLING_AREA_PADDING_X/2, y) {
|
4302
|
+
stroke :black, thickness: 2
|
4303
|
+
}
|
4304
|
+
end
|
4305
|
+
end
|
4306
|
+
|
4307
|
+
def create_gui
|
4308
|
+
@main_window = window('Basic Scrolling Area', SCROLLING_AREA_WIDTH / 2, SCROLLING_AREA_HEIGHT) {
|
4309
|
+
resizable false
|
4310
|
+
|
4311
|
+
@scrolling_area = scrolling_area(SCROLLING_AREA_WIDTH, SCROLLING_AREA_HEIGHT) {
|
4312
|
+
x_axis
|
4313
|
+
y_axis
|
4314
|
+
|
4315
|
+
@graph = figure(SCROLLING_AREA_PADDING_X, SCROLLING_AREA_HEIGHT - SCROLLING_AREA_PADDING_Y) {
|
4316
|
+
stroke :blue, thickness: 2
|
4317
|
+
}
|
4318
|
+
}
|
4319
|
+
}
|
4320
|
+
end
|
4321
|
+
end
|
4322
|
+
|
4323
|
+
BasicScrollingArea.new.launch
|
4386
4324
|
```
|
4387
4325
|
|
4388
|
-
|
4326
|
+
### Area Gallery
|
4389
4327
|
|
4390
|
-
|
4328
|
+
[examples/area_gallery.rb](examples/area_gallery.rb)
|
4391
4329
|
|
4392
|
-
|
4330
|
+
Run with this command from the root of the project if you cloned the project:
|
4331
|
+
|
4332
|
+
```
|
4333
|
+
ruby -r './lib/glimmer-dsl-libui' examples/area_gallery.rb
|
4334
|
+
```
|
4393
4335
|
|
4394
|
-
|
4336
|
+
Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-libui):
|
4395
4337
|
|
4396
|
-
|
4338
|
+
```
|
4339
|
+
ruby -r glimmer-dsl-libui -e "require 'examples/area_gallery'"
|
4340
|
+
```
|
4397
4341
|
|
4398
|
-
|
4342
|
+
Mac | Windows | Linux
|
4343
|
+
----|---------|------
|
4344
|
+
![glimmer-dsl-libui-mac-area-gallery.png](images/glimmer-dsl-libui-mac-area-gallery.png) | ![glimmer-dsl-libui-windows-area-gallery.png](images/glimmer-dsl-libui-windows-area-gallery.png) | ![glimmer-dsl-libui-linux-area-gallery.png](images/glimmer-dsl-libui-linux-area-gallery.png)
|
4399
4345
|
|
4400
4346
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
4401
4347
|
|
@@ -4406,50 +4352,50 @@ include Glimmer
|
|
4406
4352
|
|
4407
4353
|
window('Area Gallery', 400, 400) {
|
4408
4354
|
area {
|
4409
|
-
|
4410
|
-
square(0, 0, 100)
|
4411
|
-
square(100, 100, 400)
|
4412
|
-
|
4413
|
-
fill r: 102, g: 102, b: 204
|
4414
|
-
}
|
4415
|
-
path { # declarative stable path
|
4416
|
-
rectangle(0, 100, 100, 400)
|
4417
|
-
rectangle(100, 0, 400, 100)
|
4418
|
-
|
4419
|
-
# linear gradient (has x0, y0, x1, y1, and stops)
|
4420
|
-
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}]
|
4421
|
-
}
|
4422
|
-
path { # declarative stable path
|
4423
|
-
polygon(100, 100, 100, 400, 400, 100, 400, 400)
|
4424
|
-
|
4355
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
4425
4356
|
fill r: 202, g: 102, b: 104, a: 0.5
|
4426
4357
|
stroke r: 0, g: 0, b: 0
|
4427
4358
|
}
|
4428
|
-
|
4429
|
-
|
4430
|
-
|
4359
|
+
|
4360
|
+
polybezier(0, 0,
|
4361
|
+
200, 100, 100, 200, 400, 100,
|
4362
|
+
300, 100, 100, 300, 100, 400,
|
4363
|
+
100, 300, 300, 100, 400, 400) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
4431
4364
|
fill r: 202, g: 102, b: 204, a: 0.5
|
4432
4365
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4433
4366
|
}
|
4434
|
-
path { # declarative stable path
|
4435
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
4436
4367
|
|
4368
|
+
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)
|
4437
4369
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
4438
4370
|
}
|
4439
|
-
|
4440
|
-
|
4441
|
-
|
4371
|
+
|
4372
|
+
arc(404, 216, 190, 90, 90, false) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
4442
4373
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
4443
4374
|
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}]
|
4444
4375
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4445
4376
|
}
|
4446
|
-
|
4447
|
-
|
4448
|
-
|
4377
|
+
|
4378
|
+
circle(200, 200, 90) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
4449
4379
|
fill r: 202, g: 102, b: 204, a: 0.5
|
4450
4380
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
4451
4381
|
}
|
4452
|
-
|
4382
|
+
|
4383
|
+
path { # declarative stable path (explicit path syntax for multiple shapes sharing attributes)
|
4384
|
+
square(0, 0, 100)
|
4385
|
+
square(100, 100, 400)
|
4386
|
+
|
4387
|
+
fill r: 102, g: 102, b: 204
|
4388
|
+
}
|
4389
|
+
|
4390
|
+
path { # declarative stable path (explicit path syntax for multiple shapes sharing attributes)
|
4391
|
+
rectangle(0, 100, 100, 400)
|
4392
|
+
rectangle(100, 0, 400, 100)
|
4393
|
+
|
4394
|
+
# linear gradient (has x0, y0, x1, y1, and stops)
|
4395
|
+
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}]
|
4396
|
+
}
|
4397
|
+
|
4398
|
+
text(161, 40, 100) { # declarative stable text
|
4453
4399
|
string('Area Gallery') {
|
4454
4400
|
font family: 'Arial', size: (OS.mac? ? 14 : 11)
|
4455
4401
|
color :black
|
@@ -4516,12 +4462,120 @@ include Glimmer
|
|
4516
4462
|
|
4517
4463
|
window('Area Gallery', 400, 400) {
|
4518
4464
|
area {
|
4519
|
-
|
4465
|
+
|
4466
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
4467
|
+
x 100
|
4468
|
+
y 100
|
4469
|
+
|
4470
|
+
line {
|
4471
|
+
x 100
|
4472
|
+
y 400
|
4473
|
+
}
|
4474
|
+
|
4475
|
+
line {
|
4476
|
+
x 400
|
4477
|
+
y 100
|
4478
|
+
}
|
4479
|
+
|
4480
|
+
line {
|
4481
|
+
x 400
|
4482
|
+
y 400
|
4483
|
+
}
|
4484
|
+
|
4485
|
+
closed true # polygon figure is closed (last point forms a line with first point)
|
4486
|
+
fill r: 202, g: 102, b: 104, a: 0.5
|
4487
|
+
stroke r: 0, g: 0, b: 0
|
4488
|
+
}
|
4489
|
+
|
4490
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
4491
|
+
x 0
|
4492
|
+
y 0
|
4493
|
+
|
4494
|
+
bezier {
|
4495
|
+
c1_x 200
|
4496
|
+
c1_y 100
|
4497
|
+
c2_x 100
|
4498
|
+
c2_y 200
|
4499
|
+
end_x 400
|
4500
|
+
end_y 100
|
4501
|
+
}
|
4502
|
+
|
4503
|
+
bezier {
|
4504
|
+
c1_x 300
|
4505
|
+
c1_y 100
|
4506
|
+
c2_x 100
|
4507
|
+
c2_y 300
|
4508
|
+
end_x 100
|
4509
|
+
end_y 400
|
4510
|
+
}
|
4511
|
+
|
4512
|
+
bezier {
|
4513
|
+
c1_x 100
|
4514
|
+
c1_y 300
|
4515
|
+
c2_x 300
|
4516
|
+
c2_y 100
|
4517
|
+
end_x 400
|
4518
|
+
end_y 400
|
4519
|
+
}
|
4520
|
+
|
4521
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
4522
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4523
|
+
}
|
4524
|
+
|
4525
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
4526
|
+
x 100
|
4527
|
+
y 100
|
4528
|
+
|
4529
|
+
line {
|
4530
|
+
x 400
|
4531
|
+
y 100
|
4532
|
+
}
|
4533
|
+
|
4534
|
+
line {
|
4535
|
+
x 100
|
4536
|
+
y 400
|
4537
|
+
}
|
4538
|
+
|
4539
|
+
line {
|
4540
|
+
x 400
|
4541
|
+
y 400
|
4542
|
+
}
|
4543
|
+
|
4544
|
+
line {
|
4545
|
+
x 0
|
4546
|
+
y 0
|
4547
|
+
}
|
4548
|
+
|
4549
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
4550
|
+
}
|
4551
|
+
|
4552
|
+
arc { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
4553
|
+
x_center 404
|
4554
|
+
y_center 216
|
4555
|
+
radius 190
|
4556
|
+
start_angle 90
|
4557
|
+
sweep 90
|
4558
|
+
is_negative false
|
4559
|
+
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
4560
|
+
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}]
|
4561
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4562
|
+
}
|
4563
|
+
|
4564
|
+
circle { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
4565
|
+
x_center 200
|
4566
|
+
y_center 200
|
4567
|
+
radius 90
|
4568
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
4569
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
4570
|
+
}
|
4571
|
+
|
4572
|
+
path { # declarative stable path with explicit attributes (explicit path syntax for multiple shapes sharing attributes)
|
4520
4573
|
square {
|
4521
4574
|
x 0
|
4522
4575
|
y 0
|
4523
4576
|
length 100
|
4524
4577
|
}
|
4578
|
+
|
4525
4579
|
square {
|
4526
4580
|
x 100
|
4527
4581
|
y 100
|
@@ -4530,13 +4584,15 @@ window('Area Gallery', 400, 400) {
|
|
4530
4584
|
|
4531
4585
|
fill r: 102, g: 102, b: 204
|
4532
4586
|
}
|
4533
|
-
|
4587
|
+
|
4588
|
+
path { # declarative stable path with explicit attributes (explicit path syntax for multiple shapes sharing attributes)
|
4534
4589
|
rectangle {
|
4535
4590
|
x 0
|
4536
4591
|
y 100
|
4537
4592
|
width 100
|
4538
4593
|
height 400
|
4539
4594
|
}
|
4595
|
+
|
4540
4596
|
rectangle {
|
4541
4597
|
x 100
|
4542
4598
|
y 0
|
@@ -4547,115 +4603,8 @@ window('Area Gallery', 400, 400) {
|
|
4547
4603
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
4548
4604
|
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}]
|
4549
4605
|
}
|
4550
|
-
path { # declarative stable path
|
4551
|
-
figure {
|
4552
|
-
x 100
|
4553
|
-
y 100
|
4554
|
-
|
4555
|
-
line {
|
4556
|
-
x 100
|
4557
|
-
y 400
|
4558
|
-
}
|
4559
|
-
line {
|
4560
|
-
x 400
|
4561
|
-
y 100
|
4562
|
-
}
|
4563
|
-
line {
|
4564
|
-
x 400
|
4565
|
-
y 400
|
4566
|
-
}
|
4567
|
-
|
4568
|
-
closed true
|
4569
|
-
}
|
4570
|
-
|
4571
|
-
fill r: 202, g: 102, b: 104, a: 0.5
|
4572
|
-
stroke r: 0, g: 0, b: 0
|
4573
|
-
}
|
4574
|
-
path { # declarative stable path
|
4575
|
-
figure {
|
4576
|
-
x 0
|
4577
|
-
y 0
|
4578
|
-
|
4579
|
-
bezier {
|
4580
|
-
c1_x 200
|
4581
|
-
c1_y 100
|
4582
|
-
c2_x 100
|
4583
|
-
c2_y 200
|
4584
|
-
end_x 400
|
4585
|
-
end_y 100
|
4586
|
-
}
|
4587
|
-
bezier {
|
4588
|
-
c1_x 300
|
4589
|
-
c1_y 100
|
4590
|
-
c2_x 100
|
4591
|
-
c2_y 300
|
4592
|
-
end_x 100
|
4593
|
-
end_y 400
|
4594
|
-
}
|
4595
|
-
bezier {
|
4596
|
-
c1_x 100
|
4597
|
-
c1_y 300
|
4598
|
-
c2_x 300
|
4599
|
-
c2_y 100
|
4600
|
-
end_x 400
|
4601
|
-
end_y 400
|
4602
|
-
}
|
4603
|
-
}
|
4604
|
-
|
4605
|
-
fill r: 202, g: 102, b: 204, a: 0.5
|
4606
|
-
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4607
|
-
}
|
4608
|
-
path { # declarative stable path
|
4609
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
4610
|
-
figure {
|
4611
|
-
x 100
|
4612
|
-
y 100
|
4613
|
-
|
4614
|
-
line {
|
4615
|
-
x 400
|
4616
|
-
y 100
|
4617
|
-
}
|
4618
|
-
line {
|
4619
|
-
x 100
|
4620
|
-
y 400
|
4621
|
-
}
|
4622
|
-
line {
|
4623
|
-
x 400
|
4624
|
-
y 400
|
4625
|
-
}
|
4626
|
-
line {
|
4627
|
-
x 0
|
4628
|
-
y 0
|
4629
|
-
}
|
4630
|
-
}
|
4631
4606
|
|
4632
|
-
|
4633
|
-
}
|
4634
|
-
path { # declarative stable path
|
4635
|
-
arc {
|
4636
|
-
x_center 404
|
4637
|
-
y_center 216
|
4638
|
-
radius 190
|
4639
|
-
start_angle 90
|
4640
|
-
sweep 90
|
4641
|
-
is_negative false
|
4642
|
-
}
|
4643
|
-
|
4644
|
-
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
4645
|
-
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}]
|
4646
|
-
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4647
|
-
}
|
4648
|
-
path { # declarative stable path
|
4649
|
-
circle {
|
4650
|
-
x_center 200
|
4651
|
-
y_center 200
|
4652
|
-
radius 90
|
4653
|
-
}
|
4654
|
-
|
4655
|
-
fill r: 202, g: 102, b: 204, a: 0.5
|
4656
|
-
stroke r: 0, g: 0, b: 0, thickness: 2
|
4657
|
-
}
|
4658
|
-
text {
|
4607
|
+
text { # declarative stable text with explicit attributes
|
4659
4608
|
x 161
|
4660
4609
|
y 40
|
4661
4610
|
width 100
|
@@ -4729,124 +4678,231 @@ include Glimmer
|
|
4729
4678
|
window('Area Gallery', 400, 400) {
|
4730
4679
|
area {
|
4731
4680
|
on_draw do |area_draw_params|
|
4732
|
-
|
4681
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400) { # dynamic path, added semi-declaratively inside on_draw block
|
4682
|
+
fill r: 202, g: 102, b: 104, a: 0.5
|
4683
|
+
stroke r: 0, g: 0, b: 0
|
4684
|
+
}
|
4685
|
+
|
4686
|
+
polybezier(0, 0,
|
4687
|
+
200, 100, 100, 200, 400, 100,
|
4688
|
+
300, 100, 100, 300, 100, 400,
|
4689
|
+
100, 300, 300, 100, 400, 400) { # dynamic path, added semi-declaratively inside on_draw block
|
4690
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
4691
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4692
|
+
}
|
4693
|
+
|
4694
|
+
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0) { # dynamic path, added semi-declaratively inside on_draw block
|
4695
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
4696
|
+
}
|
4697
|
+
|
4698
|
+
arc(404, 216, 190, 90, 90, false) { # dynamic path, added semi-declaratively inside on_draw block
|
4699
|
+
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
4700
|
+
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}]
|
4701
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4702
|
+
}
|
4703
|
+
|
4704
|
+
circle(200, 200, 90) { # dynamic path, added semi-declaratively inside on_draw block
|
4705
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
4706
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
4707
|
+
}
|
4708
|
+
|
4709
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
4733
4710
|
square(0, 0, 100)
|
4734
4711
|
square(100, 100, 400)
|
4735
|
-
|
4712
|
+
|
4736
4713
|
fill r: 102, g: 102, b: 204
|
4737
4714
|
}
|
4738
|
-
|
4715
|
+
|
4716
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
4739
4717
|
rectangle(0, 100, 100, 400)
|
4740
4718
|
rectangle(100, 0, 400, 100)
|
4741
|
-
|
4719
|
+
|
4742
4720
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
4743
4721
|
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}]
|
4744
4722
|
}
|
4745
|
-
|
4746
|
-
|
4723
|
+
|
4724
|
+
text(161, 40, 100) { # dynamic text added semi-declaratively inside on_draw block
|
4725
|
+
string('Area Gallery') {
|
4726
|
+
font family: 'Arial', size: (OS.mac? ? 14 : 11)
|
4727
|
+
color :black
|
4728
|
+
}
|
4729
|
+
}
|
4730
|
+
end
|
4731
|
+
|
4732
|
+
on_mouse_event do |area_mouse_event|
|
4733
|
+
p area_mouse_event
|
4734
|
+
end
|
4735
|
+
|
4736
|
+
on_mouse_moved do |area_mouse_event|
|
4737
|
+
puts 'moved'
|
4738
|
+
end
|
4739
|
+
|
4740
|
+
on_mouse_down do |area_mouse_event|
|
4741
|
+
puts 'mouse down'
|
4742
|
+
end
|
4743
|
+
|
4744
|
+
on_mouse_up do |area_mouse_event|
|
4745
|
+
puts 'mouse up'
|
4746
|
+
end
|
4747
|
+
|
4748
|
+
on_mouse_drag_started do |area_mouse_event|
|
4749
|
+
puts 'drag started'
|
4750
|
+
end
|
4751
|
+
|
4752
|
+
on_mouse_dragged do |area_mouse_event|
|
4753
|
+
puts 'dragged'
|
4754
|
+
end
|
4755
|
+
|
4756
|
+
on_mouse_dropped do |area_mouse_event|
|
4757
|
+
puts 'dropped'
|
4758
|
+
end
|
4759
|
+
|
4760
|
+
on_mouse_entered do
|
4761
|
+
puts 'entered'
|
4762
|
+
end
|
4763
|
+
|
4764
|
+
on_mouse_exited do
|
4765
|
+
puts 'exited'
|
4766
|
+
end
|
4767
|
+
|
4768
|
+
on_key_event do |area_key_event|
|
4769
|
+
p area_key_event
|
4770
|
+
end
|
4771
|
+
|
4772
|
+
on_key_up do |area_key_event|
|
4773
|
+
puts 'key up'
|
4774
|
+
end
|
4775
|
+
|
4776
|
+
on_key_down do |area_key_event|
|
4777
|
+
puts 'key down'
|
4778
|
+
end
|
4779
|
+
}
|
4780
|
+
}.show
|
4781
|
+
```
|
4782
|
+
|
4783
|
+
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version 4 (setting shape properties instead of arguments with semi-declarative `on_draw` dynamic `path` approach):
|
4784
|
+
|
4785
|
+
```ruby
|
4786
|
+
require 'glimmer-dsl-libui'
|
4787
|
+
|
4788
|
+
include Glimmer
|
4789
|
+
|
4790
|
+
window('Area Gallery', 400, 400) {
|
4791
|
+
area {
|
4792
|
+
on_draw do |area_draw_params|
|
4793
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
4794
|
+
x 100
|
4795
|
+
y 100
|
4796
|
+
|
4797
|
+
line {
|
4798
|
+
x 100
|
4799
|
+
y 400
|
4800
|
+
}
|
4747
4801
|
|
4802
|
+
line {
|
4803
|
+
x 400
|
4804
|
+
y 100
|
4805
|
+
}
|
4806
|
+
|
4807
|
+
line {
|
4808
|
+
x 400
|
4809
|
+
y 400
|
4810
|
+
}
|
4811
|
+
|
4812
|
+
closed true # polygon figure is closed (last point forms a line with first point)
|
4748
4813
|
fill r: 202, g: 102, b: 104, a: 0.5
|
4749
4814
|
stroke r: 0, g: 0, b: 0
|
4750
4815
|
}
|
4751
|
-
|
4752
|
-
|
4753
|
-
|
4816
|
+
|
4817
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
4818
|
+
x 0
|
4819
|
+
y 0
|
4820
|
+
|
4821
|
+
bezier {
|
4822
|
+
c1_x 200
|
4823
|
+
c1_y 100
|
4824
|
+
c2_x 100
|
4825
|
+
c2_y 200
|
4826
|
+
end_x 400
|
4827
|
+
end_y 100
|
4828
|
+
}
|
4829
|
+
|
4830
|
+
bezier {
|
4831
|
+
c1_x 300
|
4832
|
+
c1_y 100
|
4833
|
+
c2_x 100
|
4834
|
+
c2_y 300
|
4835
|
+
end_x 100
|
4836
|
+
end_y 400
|
4837
|
+
}
|
4838
|
+
|
4839
|
+
bezier {
|
4840
|
+
c1_x 100
|
4841
|
+
c1_y 300
|
4842
|
+
c2_x 300
|
4843
|
+
c2_y 100
|
4844
|
+
end_x 400
|
4845
|
+
end_y 400
|
4846
|
+
}
|
4847
|
+
|
4754
4848
|
fill r: 202, g: 102, b: 204, a: 0.5
|
4755
4849
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4756
4850
|
}
|
4757
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4758
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
4759
4851
|
|
4852
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
4853
|
+
x 100
|
4854
|
+
y 100
|
4855
|
+
|
4856
|
+
line {
|
4857
|
+
x 400
|
4858
|
+
y 100
|
4859
|
+
}
|
4860
|
+
|
4861
|
+
line {
|
4862
|
+
x 100
|
4863
|
+
y 400
|
4864
|
+
}
|
4865
|
+
|
4866
|
+
line {
|
4867
|
+
x 400
|
4868
|
+
y 400
|
4869
|
+
}
|
4870
|
+
|
4871
|
+
line {
|
4872
|
+
x 0
|
4873
|
+
y 0
|
4874
|
+
}
|
4875
|
+
|
4760
4876
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
4761
4877
|
}
|
4762
|
-
|
4763
|
-
|
4764
|
-
|
4878
|
+
|
4879
|
+
arc { # dynamic path, added semi-declaratively inside on_draw block
|
4880
|
+
x_center 404
|
4881
|
+
y_center 216
|
4882
|
+
radius 190
|
4883
|
+
start_angle 90
|
4884
|
+
sweep 90
|
4885
|
+
is_negative false
|
4765
4886
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
4766
4887
|
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}]
|
4767
4888
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4768
4889
|
}
|
4769
|
-
|
4770
|
-
|
4771
|
-
|
4890
|
+
|
4891
|
+
circle { # dynamic path, added semi-declaratively inside on_draw block
|
4892
|
+
x_center 200
|
4893
|
+
y_center 200
|
4894
|
+
radius 90
|
4772
4895
|
fill r: 202, g: 102, b: 204, a: 0.5
|
4773
4896
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
4774
4897
|
}
|
4775
|
-
|
4776
|
-
|
4777
|
-
font family: 'Arial', size: (OS.mac? ? 14 : 11)
|
4778
|
-
color :black
|
4779
|
-
}
|
4780
|
-
}
|
4781
|
-
end
|
4782
|
-
|
4783
|
-
on_mouse_event do |area_mouse_event|
|
4784
|
-
p area_mouse_event
|
4785
|
-
end
|
4786
|
-
|
4787
|
-
on_mouse_moved do |area_mouse_event|
|
4788
|
-
puts 'moved'
|
4789
|
-
end
|
4790
|
-
|
4791
|
-
on_mouse_down do |area_mouse_event|
|
4792
|
-
puts 'mouse down'
|
4793
|
-
end
|
4794
|
-
|
4795
|
-
on_mouse_up do |area_mouse_event|
|
4796
|
-
puts 'mouse up'
|
4797
|
-
end
|
4798
|
-
|
4799
|
-
on_mouse_drag_started do |area_mouse_event|
|
4800
|
-
puts 'drag started'
|
4801
|
-
end
|
4802
|
-
|
4803
|
-
on_mouse_dragged do |area_mouse_event|
|
4804
|
-
puts 'dragged'
|
4805
|
-
end
|
4806
|
-
|
4807
|
-
on_mouse_dropped do |area_mouse_event|
|
4808
|
-
puts 'dropped'
|
4809
|
-
end
|
4810
|
-
|
4811
|
-
on_mouse_entered do
|
4812
|
-
puts 'entered'
|
4813
|
-
end
|
4814
|
-
|
4815
|
-
on_mouse_exited do
|
4816
|
-
puts 'exited'
|
4817
|
-
end
|
4818
|
-
|
4819
|
-
on_key_event do |area_key_event|
|
4820
|
-
p area_key_event
|
4821
|
-
end
|
4822
|
-
|
4823
|
-
on_key_up do |area_key_event|
|
4824
|
-
puts 'key up'
|
4825
|
-
end
|
4826
|
-
|
4827
|
-
on_key_down do |area_key_event|
|
4828
|
-
puts 'key down'
|
4829
|
-
end
|
4830
|
-
}
|
4831
|
-
}.show
|
4832
|
-
```
|
4833
|
-
|
4834
|
-
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version 4 (setting shape properties instead of arguments with semi-declarative `on_draw` dynamic `path` approach):
|
4835
|
-
|
4836
|
-
```ruby
|
4837
|
-
require 'glimmer-dsl-libui'
|
4838
|
-
|
4839
|
-
include Glimmer
|
4840
|
-
|
4841
|
-
window('Area Gallery', 400, 400) {
|
4842
|
-
area {
|
4843
|
-
on_draw do |area_draw_params|
|
4844
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4898
|
+
|
4899
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
4845
4900
|
square {
|
4846
4901
|
x 0
|
4847
4902
|
y 0
|
4848
4903
|
length 100
|
4849
4904
|
}
|
4905
|
+
|
4850
4906
|
square {
|
4851
4907
|
x 100
|
4852
4908
|
y 100
|
@@ -4855,13 +4911,15 @@ window('Area Gallery', 400, 400) {
|
|
4855
4911
|
|
4856
4912
|
fill r: 102, g: 102, b: 204
|
4857
4913
|
}
|
4858
|
-
|
4914
|
+
|
4915
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
4859
4916
|
rectangle {
|
4860
4917
|
x 0
|
4861
4918
|
y 100
|
4862
4919
|
width 100
|
4863
4920
|
height 400
|
4864
4921
|
}
|
4922
|
+
|
4865
4923
|
rectangle {
|
4866
4924
|
x 100
|
4867
4925
|
y 0
|
@@ -4872,115 +4930,8 @@ window('Area Gallery', 400, 400) {
|
|
4872
4930
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
4873
4931
|
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}]
|
4874
4932
|
}
|
4875
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4876
|
-
figure {
|
4877
|
-
x 100
|
4878
|
-
y 100
|
4879
|
-
|
4880
|
-
line {
|
4881
|
-
x 100
|
4882
|
-
y 400
|
4883
|
-
}
|
4884
|
-
line {
|
4885
|
-
x 400
|
4886
|
-
y 100
|
4887
|
-
}
|
4888
|
-
line {
|
4889
|
-
x 400
|
4890
|
-
y 400
|
4891
|
-
}
|
4892
|
-
|
4893
|
-
closed true
|
4894
|
-
}
|
4895
|
-
|
4896
|
-
fill r: 202, g: 102, b: 104, a: 0.5
|
4897
|
-
stroke r: 0, g: 0, b: 0
|
4898
|
-
}
|
4899
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4900
|
-
figure {
|
4901
|
-
x 0
|
4902
|
-
y 0
|
4903
|
-
|
4904
|
-
bezier {
|
4905
|
-
c1_x 200
|
4906
|
-
c1_y 100
|
4907
|
-
c2_x 100
|
4908
|
-
c2_y 200
|
4909
|
-
end_x 400
|
4910
|
-
end_y 100
|
4911
|
-
}
|
4912
|
-
bezier {
|
4913
|
-
c1_x 300
|
4914
|
-
c1_y 100
|
4915
|
-
c2_x 100
|
4916
|
-
c2_y 300
|
4917
|
-
end_x 100
|
4918
|
-
end_y 400
|
4919
|
-
}
|
4920
|
-
bezier {
|
4921
|
-
c1_x 100
|
4922
|
-
c1_y 300
|
4923
|
-
c2_x 300
|
4924
|
-
c2_y 100
|
4925
|
-
end_x 400
|
4926
|
-
end_y 400
|
4927
|
-
}
|
4928
|
-
}
|
4929
|
-
|
4930
|
-
fill r: 202, g: 102, b: 204, a: 0.5
|
4931
|
-
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4932
|
-
}
|
4933
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4934
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
4935
|
-
figure {
|
4936
|
-
x 100
|
4937
|
-
y 100
|
4938
|
-
|
4939
|
-
line {
|
4940
|
-
x 400
|
4941
|
-
y 100
|
4942
|
-
}
|
4943
|
-
line {
|
4944
|
-
x 100
|
4945
|
-
y 400
|
4946
|
-
}
|
4947
|
-
line {
|
4948
|
-
x 400
|
4949
|
-
y 400
|
4950
|
-
}
|
4951
|
-
line {
|
4952
|
-
x 0
|
4953
|
-
y 0
|
4954
|
-
}
|
4955
|
-
}
|
4956
4933
|
|
4957
|
-
|
4958
|
-
}
|
4959
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4960
|
-
arc {
|
4961
|
-
x_center 404
|
4962
|
-
y_center 216
|
4963
|
-
radius 190
|
4964
|
-
start_angle 90
|
4965
|
-
sweep 90
|
4966
|
-
is_negative false
|
4967
|
-
}
|
4968
|
-
|
4969
|
-
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
4970
|
-
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}]
|
4971
|
-
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
4972
|
-
}
|
4973
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
4974
|
-
circle {
|
4975
|
-
x_center 200
|
4976
|
-
y_center 200
|
4977
|
-
radius 90
|
4978
|
-
}
|
4979
|
-
|
4980
|
-
fill r: 202, g: 102, b: 204, a: 0.5
|
4981
|
-
stroke r: 0, g: 0, b: 0, thickness: 2
|
4982
|
-
}
|
4983
|
-
text {
|
4934
|
+
text { # dynamic path, added semi-declaratively inside on_draw block
|
4984
4935
|
x 161
|
4985
4936
|
y 40
|
4986
4937
|
width 100
|
@@ -5061,13 +5012,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
5061
5012
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_image'"
|
5062
5013
|
```
|
5063
5014
|
|
5064
|
-
Mac
|
5065
|
-
|
5066
|
-
![glimmer-dsl-libui-mac-basic-image.png](images/glimmer-dsl-libui-mac-basic-image.png)
|
5067
|
-
|
5068
|
-
Windows
|
5069
|
-
|
5070
|
-
![glimmer-dsl-libui-windows-basic-image.png](images/glimmer-dsl-libui-windows-basic-image.png)
|
5015
|
+
Mac | Windows | Linux
|
5016
|
+
----|---------|------
|
5017
|
+
![glimmer-dsl-libui-mac-basic-image.png](images/glimmer-dsl-libui-mac-basic-image.png) | ![glimmer-dsl-libui-windows-basic-image.png](images/glimmer-dsl-libui-windows-basic-image.png) | ![glimmer-dsl-libui-linux-basic-image.png](images/glimmer-dsl-libui-linux-basic-image.png)
|
5071
5018
|
|
5072
5019
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
5073
5020
|
|
@@ -5255,17 +5202,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
5255
5202
|
ruby -r glimmer-dsl-libui -e "require 'examples/histogram'"
|
5256
5203
|
```
|
5257
5204
|
|
5258
|
-
Mac
|
5259
|
-
|
5260
|
-
![glimmer-dsl-libui-mac-histogram.png](images/glimmer-dsl-libui-mac-histogram.png)
|
5261
|
-
|
5262
|
-
Windows
|
5263
|
-
|
5264
|
-
![glimmer-dsl-libui-windows-histogram.png](images/glimmer-dsl-libui-windows-histogram.png)
|
5265
|
-
|
5266
|
-
Linux
|
5267
|
-
|
5268
|
-
![glimmer-dsl-libui-linux-histogram.png](images/glimmer-dsl-libui-linux-histogram.png)
|
5205
|
+
Mac | Windows | Linux
|
5206
|
+
----|---------|------
|
5207
|
+
![glimmer-dsl-libui-mac-histogram.png](images/glimmer-dsl-libui-mac-histogram.png) | ![glimmer-dsl-libui-windows-histogram.png](images/glimmer-dsl-libui-windows-histogram.png) | ![glimmer-dsl-libui-linux-histogram.png](images/glimmer-dsl-libui-linux-histogram.png)
|
5269
5208
|
|
5270
5209
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
5271
5210
|
|
@@ -5593,19 +5532,46 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
5593
5532
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_transform'"
|
5594
5533
|
```
|
5595
5534
|
|
5596
|
-
Mac
|
5535
|
+
Mac | Windows | Linux
|
5536
|
+
----|---------|------
|
5537
|
+
![glimmer-dsl-libui-mac-basic-transform.png](images/glimmer-dsl-libui-mac-basic-transform.png) | ![glimmer-dsl-libui-windows-basic-transform.png](images/glimmer-dsl-libui-windows-basic-transform.png) | ![glimmer-dsl-libui-linux-basic-transform.png](images/glimmer-dsl-libui-linux-basic-transform.png)
|
5597
5538
|
|
5598
|
-
|
5599
|
-
|
5600
|
-
Windows
|
5539
|
+
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
5601
5540
|
|
5602
|
-
|
5541
|
+
```ruby
|
5542
|
+
require 'glimmer-dsl-libui'
|
5603
5543
|
|
5604
|
-
|
5544
|
+
include Glimmer
|
5605
5545
|
|
5606
|
-
|
5546
|
+
window('Basic Transform', 350, 350) {
|
5547
|
+
area {
|
5548
|
+
square(0, 0, 350) {
|
5549
|
+
fill r: 255, g: 255, b: 0
|
5550
|
+
}
|
5551
|
+
40.times do |n|
|
5552
|
+
square(0, 0, 100) {
|
5553
|
+
fill r: [255 - n*5, 0].max, g: [n*5, 255].min, b: 0, a: 0.5
|
5554
|
+
stroke :black, thickness: 2
|
5555
|
+
|
5556
|
+
transform {
|
5557
|
+
unless OS.windows?
|
5558
|
+
skew 0.15, 0.15
|
5559
|
+
translate 50, 50
|
5560
|
+
end
|
5561
|
+
rotate 100, 100, -9 * n
|
5562
|
+
scale 1.1, 1.1
|
5563
|
+
if OS.windows?
|
5564
|
+
skew 0.15, 0.15
|
5565
|
+
translate 50, 50
|
5566
|
+
end
|
5567
|
+
}
|
5568
|
+
}
|
5569
|
+
end
|
5570
|
+
}
|
5571
|
+
}.show
|
5572
|
+
```
|
5607
5573
|
|
5608
|
-
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
5574
|
+
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version 2:
|
5609
5575
|
|
5610
5576
|
```ruby
|
5611
5577
|
require 'glimmer-dsl-libui'
|
@@ -5625,11 +5591,18 @@ window('Basic Transform', 350, 350) {
|
|
5625
5591
|
|
5626
5592
|
fill r: [255 - n*5, 0].max, g: [n*5, 255].min, b: 0, a: 0.5
|
5627
5593
|
stroke :black, thickness: 2
|
5594
|
+
|
5628
5595
|
transform {
|
5629
|
-
|
5630
|
-
|
5596
|
+
unless OS.windows?
|
5597
|
+
skew 0.15, 0.15
|
5598
|
+
translate 50, 50
|
5599
|
+
end
|
5631
5600
|
rotate 100, 100, -9 * n
|
5632
5601
|
scale 1.1, 1.1
|
5602
|
+
if OS.windows?
|
5603
|
+
skew 0.15, 0.15
|
5604
|
+
translate 50, 50
|
5605
|
+
end
|
5633
5606
|
}
|
5634
5607
|
}
|
5635
5608
|
end
|
@@ -5653,20 +5626,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
5653
5626
|
ruby -r glimmer-dsl-libui -e "require 'examples/login'"
|
5654
5627
|
```
|
5655
5628
|
|
5656
|
-
Mac
|
5657
|
-
|
5658
|
-
![glimmer-dsl-libui-mac-login.png](images/glimmer-dsl-libui-mac-login.png)
|
5659
|
-
![glimmer-dsl-libui-mac-login-logged-in.png](images/glimmer-dsl-libui-mac-login-logged-in.png)
|
5660
|
-
|
5661
|
-
Windows
|
5662
|
-
|
5663
|
-
![glimmer-dsl-libui-windows-login.png](images/glimmer-dsl-libui-windows-login.png)
|
5664
|
-
![glimmer-dsl-libui-windows-login-logged-in.png](images/glimmer-dsl-libui-windows-login-logged-in.png)
|
5665
|
-
|
5666
|
-
Linux
|
5667
|
-
|
5668
|
-
![glimmer-dsl-libui-linux-login.png](images/glimmer-dsl-libui-linux-login.png)
|
5669
|
-
![glimmer-dsl-libui-linux-login-logged-in.png](images/glimmer-dsl-libui-linux-login-logged-in.png)
|
5629
|
+
Mac | Windows | Linux
|
5630
|
+
----|---------|------
|
5631
|
+
![glimmer-dsl-libui-mac-login.png](images/glimmer-dsl-libui-mac-login.png) ![glimmer-dsl-libui-mac-login-logged-in.png](images/glimmer-dsl-libui-mac-login-logged-in.png) | ![glimmer-dsl-libui-windows-login.png](images/glimmer-dsl-libui-windows-login.png) ![glimmer-dsl-libui-windows-login-logged-in.png](images/glimmer-dsl-libui-windows-login-logged-in.png) | ![glimmer-dsl-libui-linux-login.png](images/glimmer-dsl-libui-linux-login.png) ![glimmer-dsl-libui-linux-login-logged-in.png](images/glimmer-dsl-libui-linux-login-logged-in.png)
|
5670
5632
|
|
5671
5633
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
5672
5634
|
|
@@ -5734,20 +5696,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
5734
5696
|
ruby -r glimmer-dsl-libui -e "require 'examples/timer'"
|
5735
5697
|
```
|
5736
5698
|
|
5737
|
-
Mac
|
5738
|
-
|
5739
|
-
![glimmer-dsl-libui-mac-timer.png](images/glimmer-dsl-libui-mac-timer.png)
|
5740
|
-
![glimmer-dsl-libui-mac-timer-in-progress.png](images/glimmer-dsl-libui-mac-timer-in-progress.png)
|
5741
|
-
|
5742
|
-
Windows
|
5743
|
-
|
5744
|
-
![glimmer-dsl-libui-windows-timer.png](images/glimmer-dsl-libui-windows-timer.png)
|
5745
|
-
![glimmer-dsl-libui-windows-timer-in-progress.png](images/glimmer-dsl-libui-windows-timer-in-progress.png)
|
5746
|
-
|
5747
|
-
Linux
|
5748
|
-
|
5749
|
-
![glimmer-dsl-libui-linux-timer.png](images/glimmer-dsl-libui-linux-timer.png)
|
5750
|
-
![glimmer-dsl-libui-linux-timer-in-progress.png](images/glimmer-dsl-libui-linux-timer-in-progress.png)
|
5699
|
+
Mac | Windows | Linux
|
5700
|
+
----|---------|------
|
5701
|
+
![glimmer-dsl-libui-mac-timer.png](images/glimmer-dsl-libui-mac-timer.png) ![glimmer-dsl-libui-mac-timer-in-progress.png](images/glimmer-dsl-libui-mac-timer-in-progress.png) | ![glimmer-dsl-libui-windows-timer.png](images/glimmer-dsl-libui-windows-timer.png) ![glimmer-dsl-libui-windows-timer-in-progress.png](images/glimmer-dsl-libui-windows-timer-in-progress.png) | ![glimmer-dsl-libui-linux-timer.png](images/glimmer-dsl-libui-linux-timer.png) ![glimmer-dsl-libui-linux-timer-in-progress.png](images/glimmer-dsl-libui-linux-timer-in-progress.png)
|
5751
5702
|
|
5752
5703
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
5753
5704
|
|
@@ -5903,23 +5854,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
5903
5854
|
ruby -r glimmer-dsl-libui -e "require 'examples/color_the_circles'"
|
5904
5855
|
```
|
5905
5856
|
|
5906
|
-
Mac
|
5907
|
-
|
5908
|
-
![glimmer-dsl-libui-mac-color-the-circles.png](images/glimmer-dsl-libui-mac-color-the-circles.png)
|
5909
|
-
![glimmer-dsl-libui-mac-color-the-circles-lost.png](images/glimmer-dsl-libui-mac-color-the-circles-lost.png)
|
5910
|
-
![glimmer-dsl-libui-mac-color-the-circles-won.png](images/glimmer-dsl-libui-mac-color-the-circles-won.png)
|
5911
|
-
|
5912
|
-
Windows
|
5913
|
-
|
5914
|
-
![glimmer-dsl-libui-windows-color-the-circles.png](images/glimmer-dsl-libui-windows-color-the-circles.png)
|
5915
|
-
![glimmer-dsl-libui-windows-color-the-circles-lost.png](images/glimmer-dsl-libui-windows-color-the-circles-lost.png)
|
5916
|
-
![glimmer-dsl-libui-windows-color-the-circles-won.png](images/glimmer-dsl-libui-windows-color-the-circles-won.png)
|
5917
|
-
|
5918
|
-
Linux
|
5919
|
-
|
5920
|
-
![glimmer-dsl-libui-linux-color-the-circles.png](images/glimmer-dsl-libui-linux-color-the-circles.png)
|
5921
|
-
![glimmer-dsl-libui-linux-color-the-circles-lost.png](images/glimmer-dsl-libui-linux-color-the-circles-lost.png)
|
5922
|
-
![glimmer-dsl-libui-linux-color-the-circles-won.png](images/glimmer-dsl-libui-linux-color-the-circles-won.png)
|
5857
|
+
Mac | Windows | Linux
|
5858
|
+
----|---------|------
|
5859
|
+
![glimmer-dsl-libui-mac-color-the-circles.png](images/glimmer-dsl-libui-mac-color-the-circles.png) ![glimmer-dsl-libui-mac-color-the-circles-lost.png](images/glimmer-dsl-libui-mac-color-the-circles-lost.png) ![glimmer-dsl-libui-mac-color-the-circles-won.png](images/glimmer-dsl-libui-mac-color-the-circles-won.png) | ![glimmer-dsl-libui-windows-color-the-circles.png](images/glimmer-dsl-libui-windows-color-the-circles.png) ![glimmer-dsl-libui-windows-color-the-circles-lost.png](images/glimmer-dsl-libui-windows-color-the-circles-lost.png) ![glimmer-dsl-libui-windows-color-the-circles-won.png](images/glimmer-dsl-libui-windows-color-the-circles-won.png) | ![glimmer-dsl-libui-linux-color-the-circles.png](images/glimmer-dsl-libui-linux-color-the-circles.png) ![glimmer-dsl-libui-linux-color-the-circles-lost.png](images/glimmer-dsl-libui-linux-color-the-circles-lost.png) ![glimmer-dsl-libui-linux-color-the-circles-won.png](images/glimmer-dsl-libui-linux-color-the-circles-won.png)
|
5923
5860
|
|
5924
5861
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
5925
5862
|
|
@@ -5953,15 +5890,17 @@ class ColorTheCircles
|
|
5953
5890
|
|
5954
5891
|
def register_observers
|
5955
5892
|
observer = Glimmer::DataBinding::Observer.proc do |new_score|
|
5956
|
-
|
5957
|
-
|
5958
|
-
|
5959
|
-
|
5960
|
-
|
5961
|
-
|
5962
|
-
|
5963
|
-
|
5964
|
-
|
5893
|
+
Glimmer::LibUI.queue_main do
|
5894
|
+
@score_label.text = new_score.to_s
|
5895
|
+
if new_score == -20
|
5896
|
+
@game_over = true
|
5897
|
+
msg_box('You Lost!', 'Sorry! Your score reached -20')
|
5898
|
+
restart_game
|
5899
|
+
elsif new_score == 0
|
5900
|
+
@game_over = true
|
5901
|
+
msg_box('You Won!', 'Congratulations! Your score reached 0')
|
5902
|
+
restart_game
|
5903
|
+
end
|
5965
5904
|
end
|
5966
5905
|
end
|
5967
5906
|
observer.observe(self, :score) # automatically enhances self to become Glimmer::DataBinding::ObservableModel and notify observer on score attribute changes
|
@@ -6125,9 +6064,7 @@ class ColorTheCircles
|
|
6125
6064
|
}
|
6126
6065
|
|
6127
6066
|
@circles_data.each do |circle_data|
|
6128
|
-
|
6129
|
-
circle_data[:circle] = circle(*circle_data[:args])
|
6130
|
-
|
6067
|
+
circle_data[:circle] = circle(*circle_data[:args]) {
|
6131
6068
|
fill circle_data[:fill]
|
6132
6069
|
stroke circle_data[:stroke]
|
6133
6070
|
}
|
@@ -6162,17 +6099,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
6162
6099
|
ruby -r glimmer-dsl-libui -e "require 'examples/basic_draw_text'"
|
6163
6100
|
```
|
6164
6101
|
|
6165
|
-
Mac
|
6166
|
-
|
6167
|
-
![glimmer-dsl-libui-mac-basic-draw-text.png](images/glimmer-dsl-libui-mac-basic-draw-text.png)
|
6168
|
-
|
6169
|
-
Windows
|
6170
|
-
|
6171
|
-
![glimmer-dsl-libui-windows-basic-draw-text.png](images/glimmer-dsl-libui-windows-basic-draw-text.png)
|
6172
|
-
|
6173
|
-
Linux
|
6174
|
-
|
6175
|
-
![glimmer-dsl-libui-linux-basic-draw-text.png](images/glimmer-dsl-libui-linux-basic-draw-text.png)
|
6102
|
+
Mac | Windows | Linux
|
6103
|
+
----|---------|------
|
6104
|
+
![glimmer-dsl-libui-mac-basic-draw-text.png](images/glimmer-dsl-libui-mac-basic-draw-text.png) | ![glimmer-dsl-libui-windows-basic-draw-text.png](images/glimmer-dsl-libui-windows-basic-draw-text.png) | ![glimmer-dsl-libui-linux-basic-draw-text.png](images/glimmer-dsl-libui-linux-basic-draw-text.png)
|
6176
6105
|
|
6177
6106
|
[LibUI](https://github.com/kojix2/LibUI) Original Version:
|
6178
6107
|
|
@@ -6448,20 +6377,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
6448
6377
|
ruby -r glimmer-dsl-libui -e "require 'examples/custom_draw_text'"
|
6449
6378
|
```
|
6450
6379
|
|
6451
|
-
Mac
|
6452
|
-
|
6453
|
-
![glimmer-dsl-libui-mac-custom-draw-text.png](images/glimmer-dsl-libui-mac-custom-draw-text.png)
|
6454
|
-
![glimmer-dsl-libui-mac-custom-draw-text-changed.png](images/glimmer-dsl-libui-mac-custom-draw-text-changed.png)
|
6455
|
-
|
6456
|
-
Windows
|
6457
|
-
|
6458
|
-
![glimmer-dsl-libui-windows-custom-draw-text.png](images/glimmer-dsl-libui-windows-custom-draw-text.png)
|
6459
|
-
![glimmer-dsl-libui-windows-custom-draw-text-changed.png](images/glimmer-dsl-libui-windows-custom-draw-text-changed.png)
|
6460
|
-
|
6461
|
-
Linux
|
6462
|
-
|
6463
|
-
![glimmer-dsl-libui-linux-custom-draw-text.png](images/glimmer-dsl-libui-linux-custom-draw-text.png)
|
6464
|
-
![glimmer-dsl-libui-linux-custom-draw-text-changed.png](images/glimmer-dsl-libui-linux-custom-draw-text-changed.png)
|
6380
|
+
Mac | Windows | Linux
|
6381
|
+
----|---------|------
|
6382
|
+
![glimmer-dsl-libui-mac-custom-draw-text.png](images/glimmer-dsl-libui-mac-custom-draw-text.png) ![glimmer-dsl-libui-mac-custom-draw-text-changed.png](images/glimmer-dsl-libui-mac-custom-draw-text-changed.png) | ![glimmer-dsl-libui-windows-custom-draw-text.png](images/glimmer-dsl-libui-windows-custom-draw-text.png) ![glimmer-dsl-libui-windows-custom-draw-text-changed.png](images/glimmer-dsl-libui-windows-custom-draw-text-changed.png) | ![glimmer-dsl-libui-linux-custom-draw-text.png](images/glimmer-dsl-libui-linux-custom-draw-text.png) ![glimmer-dsl-libui-linux-custom-draw-text-changed.png](images/glimmer-dsl-libui-linux-custom-draw-text-changed.png)
|
6465
6383
|
|
6466
6384
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
6467
6385
|
|
@@ -6668,17 +6586,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
6668
6586
|
ruby -r glimmer-dsl-libui -e "require 'examples/method_based_custom_keyword'"
|
6669
6587
|
```
|
6670
6588
|
|
6671
|
-
Mac
|
6672
|
-
|
6673
|
-
![glimmer-dsl-libui-mac-method-based-custom-keyword.png](images/glimmer-dsl-libui-mac-method-based-custom-keyword.png)
|
6674
|
-
|
6675
|
-
Windows
|
6676
|
-
|
6677
|
-
![glimmer-dsl-libui-windows-method-based-custom-keyword.png](images/glimmer-dsl-libui-windows-method-based-custom-keyword.png)
|
6678
|
-
|
6679
|
-
Linux
|
6680
|
-
|
6681
|
-
![glimmer-dsl-libui-linux-method-based-custom-keyword.png](images/glimmer-dsl-libui-linux-method-based-custom-keyword.png)
|
6589
|
+
Mac | Windows | Linux
|
6590
|
+
----|---------|------
|
6591
|
+
![glimmer-dsl-libui-mac-method-based-custom-keyword.png](images/glimmer-dsl-libui-mac-method-based-custom-keyword.png) | ![glimmer-dsl-libui-windows-method-based-custom-keyword.png](images/glimmer-dsl-libui-windows-method-based-custom-keyword.png) | ![glimmer-dsl-libui-linux-method-based-custom-keyword.png](images/glimmer-dsl-libui-linux-method-based-custom-keyword.png)
|
6682
6592
|
|
6683
6593
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
6684
6594
|
|
@@ -6800,29 +6710,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
6800
6710
|
ruby -r glimmer-dsl-libui -e "require 'examples/tetris'"
|
6801
6711
|
```
|
6802
6712
|
|
6803
|
-
Mac
|
6804
|
-
|
6805
|
-
![glimmer-dsl-libui-mac-tetris.png](images/glimmer-dsl-libui-mac-tetris.png)
|
6806
|
-
|
6807
|
-
![glimmer-dsl-libui-mac-tetris-game-over.png](images/glimmer-dsl-libui-mac-tetris-game-over.png)
|
6808
|
-
|
6809
|
-
![glimmer-dsl-libui-mac-tetris-high-scores.png](images/glimmer-dsl-libui-mac-tetris-high-scores.png)
|
6810
|
-
|
6811
|
-
Windows
|
6812
|
-
|
6813
|
-
![glimmer-dsl-libui-windows-tetris.png](images/glimmer-dsl-libui-windows-tetris.png)
|
6814
|
-
|
6815
|
-
![glimmer-dsl-libui-windows-tetris-game-over.png](images/glimmer-dsl-libui-windows-tetris-game-over.png)
|
6816
|
-
|
6817
|
-
![glimmer-dsl-libui-windows-tetris-high-scores.png](images/glimmer-dsl-libui-windows-tetris-high-scores.png)
|
6818
|
-
|
6819
|
-
Linux
|
6820
|
-
|
6821
|
-
![glimmer-dsl-libui-linux-tetris.png](images/glimmer-dsl-libui-linux-tetris.png)
|
6822
|
-
|
6823
|
-
![glimmer-dsl-libui-linux-tetris-game-over.png](images/glimmer-dsl-libui-linux-tetris-game-over.png)
|
6824
|
-
|
6825
|
-
![glimmer-dsl-libui-linux-tetris-high-scores.png](images/glimmer-dsl-libui-linux-tetris-high-scores.png)
|
6713
|
+
Mac | Windows | Linux
|
6714
|
+
----|---------|------
|
6715
|
+
![glimmer-dsl-libui-mac-tetris.png](images/glimmer-dsl-libui-mac-tetris.png) ![glimmer-dsl-libui-mac-tetris-game-over.png](images/glimmer-dsl-libui-mac-tetris-game-over.png) ![glimmer-dsl-libui-mac-tetris-high-scores.png](images/glimmer-dsl-libui-mac-tetris-high-scores.png) | ![glimmer-dsl-libui-windows-tetris.png](images/glimmer-dsl-libui-windows-tetris.png) ![glimmer-dsl-libui-windows-tetris-game-over.png](images/glimmer-dsl-libui-windows-tetris-game-over.png) ![glimmer-dsl-libui-windows-tetris-high-scores.png](images/glimmer-dsl-libui-windows-tetris-high-scores.png) | ![glimmer-dsl-libui-linux-tetris.png](images/glimmer-dsl-libui-linux-tetris.png) ![glimmer-dsl-libui-linux-tetris-game-over.png](images/glimmer-dsl-libui-linux-tetris-game-over.png) ![glimmer-dsl-libui-linux-tetris-high-scores.png](images/glimmer-dsl-libui-linux-tetris-high-scores.png)
|
6826
6716
|
|
6827
6717
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
6828
6718
|
|
@@ -6982,6 +6872,8 @@ class Tetris
|
|
6982
6872
|
end
|
6983
6873
|
}
|
6984
6874
|
radio_menu_item('Rotate Left on Up Arrow') {
|
6875
|
+
checked true
|
6876
|
+
|
6985
6877
|
on_clicked do
|
6986
6878
|
@game.rotate_left_on_up = true
|
6987
6879
|
end
|
@@ -7030,34 +6922,31 @@ class Tetris
|
|
7030
6922
|
bevel_pixel_size = 0.16 * block_size.to_f
|
7031
6923
|
color = Glimmer::LibUI.interpret_color(Model::Block::COLOR_CLEAR)
|
7032
6924
|
area {
|
7033
|
-
block[:background_square] =
|
7034
|
-
square(0, 0, block_size)
|
7035
|
-
|
6925
|
+
block[:background_square] = square(0, 0, block_size) {
|
7036
6926
|
fill color
|
7037
6927
|
}
|
7038
|
-
|
7039
|
-
|
7040
|
-
|
6928
|
+
|
6929
|
+
block[:top_bevel_edge] = polygon {
|
6930
|
+
point_array 0, 0, block_size, 0, block_size - bevel_pixel_size, bevel_pixel_size, bevel_pixel_size, bevel_pixel_size
|
7041
6931
|
fill r: color[:r] + 4*BEVEL_CONSTANT, g: color[:g] + 4*BEVEL_CONSTANT, b: color[:b] + 4*BEVEL_CONSTANT
|
7042
6932
|
}
|
7043
|
-
|
7044
|
-
|
7045
|
-
|
6933
|
+
|
6934
|
+
block[:right_bevel_edge] = polygon {
|
6935
|
+
point_array 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
|
7046
6936
|
fill r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT
|
7047
6937
|
}
|
7048
|
-
|
7049
|
-
|
7050
|
-
|
6938
|
+
|
6939
|
+
block[:bottom_bevel_edge] = polygon {
|
6940
|
+
point_array 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
|
7051
6941
|
fill r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT
|
7052
6942
|
}
|
7053
|
-
|
7054
|
-
|
7055
|
-
|
6943
|
+
|
6944
|
+
block[:left_bevel_edge] = polygon {
|
6945
|
+
point_array 0, 0, 0, block_size, bevel_pixel_size, block_size - bevel_pixel_size, bevel_pixel_size, bevel_pixel_size
|
7056
6946
|
fill r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT
|
7057
6947
|
}
|
7058
|
-
|
7059
|
-
|
7060
|
-
|
6948
|
+
|
6949
|
+
block[:border_square] = square(0, 0, block_size) {
|
7061
6950
|
stroke COLOR_GRAY
|
7062
6951
|
}
|
7063
6952
|
|
@@ -7217,35 +7106,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
7217
7106
|
ruby -r glimmer-dsl-libui -e "require 'examples/tic_tac_toe'"
|
7218
7107
|
```
|
7219
7108
|
|
7220
|
-
Mac
|
7221
|
-
|
7222
|
-
![glimmer-dsl-libui-mac-tic-tac-toe.png](images/glimmer-dsl-libui-mac-tic-tac-toe.png)
|
7223
|
-
|
7224
|
-
![glimmer-dsl-libui-mac-tic-tac-toe-player-o-wins.png](images/glimmer-dsl-libui-mac-tic-tac-toe-player-o-wins.png)
|
7225
|
-
|
7226
|
-
![glimmer-dsl-libui-mac-tic-tac-toe-player-x-wins.png](images/glimmer-dsl-libui-mac-tic-tac-toe-player-x-wins.png)
|
7227
|
-
|
7228
|
-
![glimmer-dsl-libui-mac-tic-tac-toe-draw.png](images/glimmer-dsl-libui-mac-tic-tac-toe-draw.png)
|
7229
|
-
|
7230
|
-
Windows
|
7231
|
-
|
7232
|
-
![glimmer-dsl-libui-windows-tic-tac-toe.png](images/glimmer-dsl-libui-windows-tic-tac-toe.png)
|
7233
|
-
|
7234
|
-
![glimmer-dsl-libui-windows-tic-tac-toe-player-o-wins.png](images/glimmer-dsl-libui-windows-tic-tac-toe-player-o-wins.png)
|
7235
|
-
|
7236
|
-
![glimmer-dsl-libui-windows-tic-tac-toe-player-x-wins.png](images/glimmer-dsl-libui-windows-tic-tac-toe-player-x-wins.png)
|
7237
|
-
|
7238
|
-
![glimmer-dsl-libui-windows-tic-tac-toe-draw.png](images/glimmer-dsl-libui-windows-tic-tac-toe-draw.png)
|
7239
|
-
|
7240
|
-
Linux
|
7241
|
-
|
7242
|
-
![glimmer-dsl-libui-linux-tic-tac-toe.png](images/glimmer-dsl-libui-linux-tic-tac-toe.png)
|
7243
|
-
|
7244
|
-
![glimmer-dsl-libui-linux-tic-tac-toe-player-o-wins.png](images/glimmer-dsl-libui-linux-tic-tac-toe-player-o-wins.png)
|
7245
|
-
|
7246
|
-
![glimmer-dsl-libui-linux-tic-tac-toe-player-x-wins.png](images/glimmer-dsl-libui-linux-tic-tac-toe-player-x-wins.png)
|
7247
|
-
|
7248
|
-
![glimmer-dsl-libui-linux-tic-tac-toe-draw.png](images/glimmer-dsl-libui-linux-tic-tac-toe-draw.png)
|
7109
|
+
Mac | Windows | Linux
|
7110
|
+
----|---------|------
|
7111
|
+
![glimmer-dsl-libui-mac-tic-tac-toe.png](images/glimmer-dsl-libui-mac-tic-tac-toe.png) ![glimmer-dsl-libui-mac-tic-tac-toe-player-o-wins.png](images/glimmer-dsl-libui-mac-tic-tac-toe-player-o-wins.png) ![glimmer-dsl-libui-mac-tic-tac-toe-player-x-wins.png](images/glimmer-dsl-libui-mac-tic-tac-toe-player-x-wins.png) ![glimmer-dsl-libui-mac-tic-tac-toe-draw.png](images/glimmer-dsl-libui-mac-tic-tac-toe-draw.png) | ![glimmer-dsl-libui-windows-tic-tac-toe.png](images/glimmer-dsl-libui-windows-tic-tac-toe.png) ![glimmer-dsl-libui-windows-tic-tac-toe-player-o-wins.png](images/glimmer-dsl-libui-windows-tic-tac-toe-player-o-wins.png) ![glimmer-dsl-libui-windows-tic-tac-toe-player-x-wins.png](images/glimmer-dsl-libui-windows-tic-tac-toe-player-x-wins.png) ![glimmer-dsl-libui-windows-tic-tac-toe-draw.png](images/glimmer-dsl-libui-windows-tic-tac-toe-draw.png) | ![glimmer-dsl-libui-linux-tic-tac-toe.png](images/glimmer-dsl-libui-linux-tic-tac-toe.png) ![glimmer-dsl-libui-linux-tic-tac-toe-player-o-wins.png](images/glimmer-dsl-libui-linux-tic-tac-toe-player-o-wins.png) ![glimmer-dsl-libui-linux-tic-tac-toe-player-x-wins.png](images/glimmer-dsl-libui-linux-tic-tac-toe-player-x-wins.png) ![glimmer-dsl-libui-linux-tic-tac-toe-draw.png](images/glimmer-dsl-libui-linux-tic-tac-toe-draw.png)
|
7249
7112
|
|
7250
7113
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
7251
7114
|
|
@@ -7297,14 +7160,12 @@ class TicTacToe
|
|
7297
7160
|
|
7298
7161
|
3.times.map do |column|
|
7299
7162
|
area {
|
7300
|
-
|
7301
|
-
square(0, 0, 60)
|
7302
|
-
|
7163
|
+
square(0, 0, 60) {
|
7303
7164
|
stroke :black, thickness: 2
|
7304
7165
|
}
|
7305
7166
|
text(23, 19) {
|
7306
7167
|
@cells[row] << string('') {
|
7307
|
-
font family: 'Arial', size: 20
|
7168
|
+
font family: 'Arial', size: OS.mac? ? 20 : 16
|
7308
7169
|
}
|
7309
7170
|
}
|
7310
7171
|
on_mouse_up do
|
@@ -7355,23 +7216,9 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
7355
7216
|
ruby -r glimmer-dsl-libui -e "require 'examples/snake'"
|
7356
7217
|
```
|
7357
7218
|
|
7358
|
-
Mac
|
7359
|
-
|
7360
|
-
![glimmer-dsl-libui-mac-snake.png](images/glimmer-dsl-libui-mac-snake.png)
|
7361
|
-
|
7362
|
-
![glimmer-dsl-libui-mac-snake-game-over.png](images/glimmer-dsl-libui-mac-snake-game-over.png)
|
7363
|
-
|
7364
|
-
Windows
|
7365
|
-
|
7366
|
-
![glimmer-dsl-libui-windows-snake.png](images/glimmer-dsl-libui-windows-snake.png)
|
7367
|
-
|
7368
|
-
![glimmer-dsl-libui-windows-snake-game-over.png](images/glimmer-dsl-libui-windows-snake-game-over.png)
|
7369
|
-
|
7370
|
-
Linux
|
7371
|
-
|
7372
|
-
![glimmer-dsl-libui-linux-snake.png](images/glimmer-dsl-libui-linux-snake.png)
|
7373
|
-
|
7374
|
-
![glimmer-dsl-libui-linux-snake-game-over.png](images/glimmer-dsl-libui-linux-snake-game-over.png)
|
7219
|
+
Mac | Windows | Linux
|
7220
|
+
----|---------|------
|
7221
|
+
![glimmer-dsl-libui-mac-snake.png](images/glimmer-dsl-libui-mac-snake.png) ![glimmer-dsl-libui-mac-snake-game-over.png](images/glimmer-dsl-libui-mac-snake-game-over.png) | ![glimmer-dsl-libui-windows-snake.png](images/glimmer-dsl-libui-windows-snake.png) ![glimmer-dsl-libui-windows-snake-game-over.png](images/glimmer-dsl-libui-windows-snake-game-over.png) | ![glimmer-dsl-libui-linux-snake.png](images/glimmer-dsl-libui-linux-snake.png) ![glimmer-dsl-libui-linux-snake-game-over.png](images/glimmer-dsl-libui-linux-snake-game-over.png)
|
7375
7222
|
|
7376
7223
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
7377
7224
|
|
@@ -7410,7 +7257,7 @@ class Snake
|
|
7410
7257
|
Glimmer::DataBinding::Observer.proc do |game_over|
|
7411
7258
|
Glimmer::LibUI.queue_main do
|
7412
7259
|
if game_over
|
7413
|
-
msg_box('Game Over!', "Score: #{@game.score}")
|
7260
|
+
msg_box('Game Over!', "Score: #{@game.score} | High Score: #{@game.high_score}")
|
7414
7261
|
@game.start
|
7415
7262
|
end
|
7416
7263
|
end
|
@@ -7419,7 +7266,7 @@ class Snake
|
|
7419
7266
|
Glimmer::LibUI.timer(SNAKE_MOVE_DELAY) do
|
7420
7267
|
unless @game.over?
|
7421
7268
|
@game.snake.move
|
7422
|
-
@main_window.title = "Glimmer Snake (Score: #{@game.score})"
|
7269
|
+
@main_window.title = "Glimmer Snake (Score: #{@game.score} | High Score: #{@game.high_score})"
|
7423
7270
|
end
|
7424
7271
|
end
|
7425
7272
|
end
|
@@ -7439,9 +7286,7 @@ class Snake
|
|
7439
7286
|
|
7440
7287
|
@game.width.times do |column|
|
7441
7288
|
area {
|
7442
|
-
@cell_grid.last <<
|
7443
|
-
square(0, 0, CELL_SIZE)
|
7444
|
-
|
7289
|
+
@cell_grid.last << square(0, 0, CELL_SIZE) {
|
7445
7290
|
fill Presenter::Cell::COLOR_CLEAR
|
7446
7291
|
}
|
7447
7292
|
|