glimmer-dsl-libui 0.4.21 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +117 -36
- data/VERSION +1 -1
- data/examples/color_the_circles.rb +1 -1
- data/examples/tetris/model/game.rb +25 -23
- data/examples/tetris.rb +50 -19
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/libui/shape/arc.rb +17 -0
- data/lib/glimmer/libui/shape/bezier.rb +9 -0
- data/lib/glimmer/libui/shape/circle.rb +7 -2
- data/lib/glimmer/libui/shape/line.rb +9 -0
- data/lib/glimmer/libui/shape/rectangle.rb +7 -2
- data/lib/glimmer/libui/shape/square.rb +9 -2
- data/lib/glimmer/libui/shape.rb +40 -0
- data/lib/glimmer-dsl-libui.rb +1 -0
- metadata +27 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5fd4f6d3b6fcc780223f17cd51767f153a77c73472434fdc8d13995ba8ddc00
|
4
|
+
data.tar.gz: 965a9726bf24afe64ac5e5288e60e9b9a2f1dd2e7ae6f81e49fbfead40bc07ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f3e4b130032060d4ea47528c6b6f80c8080917a9d50fcb3f0d4d11718594f1913e6a417c83d25a7e8c74136a7ce3597bf501f29339f48aa3ea577532f0af5e2
|
7
|
+
data.tar.gz: 66f8aa203283d3a4ef570690573c6344b0024f57164abfd16502153efa9ad49b1eaedf8d204a9723882fd86068bf2be44f30eb3b890b4e1d20ba73189677ca2e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.5.2
|
4
|
+
|
5
|
+
- Support `line` `bounding_box` (minx, miny, width, height), `contain?` method (checking if shape contains point inside) and `include?` method (checking on outline if stroked and inside if filled?)
|
6
|
+
- Support `bezier` `bounding_box` (minx, miny, width, height), `contain?` method (checking if shape contains point inside) and `include?` method (checking on outline if stroked and inside if filled?)
|
7
|
+
|
8
|
+
## 0.5.1
|
9
|
+
|
10
|
+
- Upgrade to libui 0.0.14
|
11
|
+
- Alter `Shape#contain?` to support `outline: ` and `distance_tolerance: ` options as per perfect-shape gem
|
12
|
+
- Support `arc` `bounding_box` (minx, miny, width, height), `contain?` method (checking if shape contains point inside) and `include?` method (checking on outline if stroked and inside if filled?)
|
13
|
+
- Support `circle` `bounding_box` (minx, miny, width, height), `contain?` method (checking if shape contains point inside) and `include?` method (checking on outline if stroked and inside if filled?)
|
14
|
+
|
15
|
+
## 0.5.0
|
16
|
+
|
17
|
+
- Upgrade to glimmer 2.6.0
|
18
|
+
- Support `rectangle` `bounding_box` (minx, miny, width, height), `contain?` method (checking if shape contains point inside) and `include?` method (checking on outline if stroked and inside if filled?)
|
19
|
+
- Support `square` `bounding_box` (minx, miny, width, height), `contain?` method (checking if shape contains point inside) and `include?` method (checking on outline if stroked and inside if filled?)
|
20
|
+
|
21
|
+
## 0.4.22
|
22
|
+
|
23
|
+
- examples/tetris.rb "Show Next Block Preview" menu item under "View" menu
|
24
|
+
- examples/tetris.rb "Speed" menu
|
25
|
+
- Fix issue with examples/tetris.rb not accelerating upon level ups
|
26
|
+
|
3
27
|
## 0.4.21
|
4
28
|
|
5
29
|
- Pause via spacebar in examples/snake.rb (all versions)
|
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
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.
|
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.5.2
|
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
|
+
[**(Fukuoka Ruby Award Competition 2022 Special Award Winner)**](http://www.digitalfukuoka.jp/topics/187?locale=ja)
|
7
|
+
|
8
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [LibUI](https://github.com/kojix2/LibUI) is a prerequisite-free [MRI Ruby](https://www.ruby-lang.org) desktop development GUI (Graphical User Interface) library. No need to pre-install any prerequisites. Just install the [gem](https://rubygems.org/gems/glimmer-dsl-libui) and have platform-independent native GUI that just works!
|
7
9
|
|
8
10
|
Mac | Windows | Linux
|
9
11
|
----|---------|------
|
@@ -328,15 +330,21 @@ Mac | Windows | Linux
|
|
328
330
|
|
329
331
|
![glimmer-dsl-libui-mac-tetris.gif](images/glimmer-dsl-libui-mac-tetris.gif)
|
330
332
|
|
331
|
-
NOTE: [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) is 100% 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.
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
-
|
338
|
-
-
|
339
|
-
|
333
|
+
NOTE: [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) is 100% feature-complete with regards to covering the C [libui](https://github.com/andlabs/libui) library API and in beta mode (though the C [libui](https://github.com/andlabs/libui) is still mid-alpha, which is why [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) cannot be declared v1.0.0 yet). 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.
|
334
|
+
|
335
|
+
**[Glimmer](https://rubygems.org/gems/glimmer) DSL Comparison Table:**
|
336
|
+
DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
337
|
+
----|-----------|---------|------------------|------|------|--------
|
338
|
+
[Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](https://github.com/AndyObtiva/glimmer-dsl-swt) | Mac / Windows / Linux | Yes | Yes (Canvas Shape DSL) | Very Mature / Scaffolding / Native Executable Packaging / Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint | Java / JRuby
|
339
|
+
[Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](https://github.com/AndyObtiva/glimmer-dsl-opal) | All Web Browsers | No | Yes (Canvas Shape DSL) | Simpler than All JavaScript Technologies / Auto-Webify Desktop Apps | Setup Process / Only Rails 5 Support for Now | Rails
|
340
|
+
[Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-libui) | Mac / Windows / Linux | Yes | Yes (Area API) | Fast Startup Time / Light Memory Footprint | LibUI is an Incomplete Mid-Alpha Only | None Other Than MRI Ruby
|
341
|
+
[Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-tk) | Mac / Windows / Linux | Some Native-Themed Widgets (Not Truly Native) | Yes (Canvas) | Fast Startup Time / Light Memory Footprint | Widgets Do Not Look Truly Native, Espcially on Linux | ActiveTcl / MRI Ruby
|
342
|
+
[Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-gtk) | Mac / Windows / Linux | Only on Linux | Yes (Cairo) | Complete Access to GNOME Features on Linux (Forte) | Not Native on Mac and Windows | None Other Than MRI Ruby on Linux / Brew Packages on Mac / MSYS & MING Toolchains on Windows / MRI Ruby
|
343
|
+
[Glimmer DSL for FX (FOX Toolkit Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-fx) | Mac (requires XQuartz) / Windows / Linux | No | Yes (Canvas) | No Prerequisites on Windows (Forte Since Binaries Are Included Out of The Box) | Widgets Do Not Look Native / Mac Usage Obtrusively Starts XQuartz | None Other Than MRI Ruby on Windows / XQuarts on Mac / MRI Ruby
|
344
|
+
[Glimmer DSL for JFX (JRuby JavaFX Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-jfx) | Mac / Windows / Linux | No | Yes (javafx.scene.shape and javafx.scene.canvas) | Rich in Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby / JavaFX SDK
|
345
|
+
[Glimmer DSL for Swing (JRuby Swing Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-swing) | Mac / Windows / Linux | No | Yes (Java2D) | Very Mature | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby
|
346
|
+
[Glimmer DSL for XML (& HTML)](https://github.com/AndyObtiva/glimmer-dsl-xml) | All Web Browsers | No | Yes (SVG) | Programmable / Lighter-weight Than Actual XML | XML Elements Are Sometimes Not Well-Named (Many Types of Input) | None
|
347
|
+
[Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css) | All Web Browsers | No | Yes | Programmable | CSS Is Over-Engineered / Too Many Features To Learn | None
|
340
348
|
|
341
349
|
## Table of Contents
|
342
350
|
|
@@ -511,7 +519,7 @@ gem install glimmer-dsl-libui
|
|
511
519
|
Or install via Bundler `Gemfile`:
|
512
520
|
|
513
521
|
```ruby
|
514
|
-
gem 'glimmer-dsl-libui', '~> 0.
|
522
|
+
gem 'glimmer-dsl-libui', '~> 0.5.2'
|
515
523
|
```
|
516
524
|
|
517
525
|
Test that installation worked by running the [Meta-Example](#examples):
|
@@ -581,13 +589,14 @@ w.set_title 'aloha'
|
|
581
589
|
puts w.title # => aloha
|
582
590
|
```
|
583
591
|
|
584
|
-
Controls are wrapped as Ruby proxy objects, having a `#libui` method to obtain the wrapped [LibUI](https://github.com/kojix2/LibUI) Fiddle pointer object. Ruby proxy objects rely on composition (via [Proxy Design Pattern](https://en.wikipedia.org/wiki/Proxy_pattern)) instead of inheritance to shield consumers from having to deal with lower-level details unless absolutely needed.
|
592
|
+
Controls are wrapped as Ruby proxy objects, having a `#libui` method to obtain the wrapped [LibUI](https://github.com/kojix2/LibUI) Fiddle pointer object. Ruby proxy objects rely on composition (via [Proxy Design Pattern](https://en.wikipedia.org/wiki/Proxy_pattern)) instead of inheritance to shield consumers from having to deal with lower-level details unless absolutely needed. That said, you can invoke any [LibUI operation](#libui-operations) on the Glimmer proxy object directly and it gets proxied automatically to the wrapped Fiddle pointer object (e.g. `window_proxy.title` gets proxied to `LibUI.window_title(window_proxy.libui).to_s` automatically), so you rarely have to refer to the wrapped `#libui` Fiddle pointer object directly.
|
585
593
|
|
586
594
|
Example (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
587
595
|
|
588
596
|
```ruby
|
589
597
|
w = window('hello world') # => #<Glimmer::LibUI::WindowProxy:0x00007fde4ea39fb0
|
590
598
|
w.libui # => #<Fiddle::Pointer:0x00007fde53997980 ptr=0x00007fde51352a60 size=0 free=0x0000000000000000>
|
599
|
+
w.title == LibUI.window_title(w.libui).to_s # => true
|
591
600
|
```
|
592
601
|
|
593
602
|
### Supported Keywords
|
@@ -976,6 +985,14 @@ Mac | Windows | Linux
|
|
976
985
|
----|---------|------
|
977
986
|
![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)
|
978
987
|
|
988
|
+
##### Shape Methods
|
989
|
+
|
990
|
+
- `::parameters`: returns parameters of a shape class
|
991
|
+
- `#bounding_box`: returns `Array` containing `[min_x, min_y, width, height]`
|
992
|
+
- `#contain?(*point, outline: false, distance_tolerance: 0)`: Returns if point (`[x, y]` `Array` or args) is inside the shape when `outline` is `false` or on the outline when `outline` is `true`. `distance_tolerance` is used when `outline` is `true` as a fuzz factor for declaring a point on the outline of the shape (e.g. helps users select a shape from its outline more easily).
|
993
|
+
- `#include?(*point)`: Returns if point (`[x, y]` `Array` or args) is inside the shape when filled (having `fill` value) or on the outline when stroked (not having `fill` value yet `stroke` value only)
|
994
|
+
- `#perfect_shape`: returns [PerfectShape](https://github.com/AndyObtiva/perfect-shape) object matching the [libui](https://github.com/andlabs/libui) shape.
|
995
|
+
|
979
996
|
#### Area Text
|
980
997
|
|
981
998
|
To draw `text` in an `area`, you simply nest a `text(x, y, width)` control directly under `area` or inside a `on_draw` listener, and then nest attributed `string {[attributes]; string_value}` controls underneath it returning an actual `String` (think of them as the `<span>` or `<p>` element in html, which contains a string of text). Alternatively, you can nest attributed `string(string_value) {[attributes]}` if `string_value` is a short single-line string. An attributed `string` value can be changed dynamically via its `string` property.
|
@@ -999,15 +1016,49 @@ To draw `text` in an `area`, you simply nest a `text(x, y, width)` control direc
|
|
999
1016
|
Example (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
1000
1017
|
|
1001
1018
|
```ruby
|
1019
|
+
require 'glimmer-dsl-libui'
|
1020
|
+
|
1021
|
+
include Glimmer
|
1022
|
+
|
1002
1023
|
window('area text drawing') {
|
1003
1024
|
area {
|
1004
1025
|
text {
|
1005
1026
|
default_font family: 'Helvetica', size: 12, weight: :normal, italic: :normal, stretch: :normal
|
1006
1027
|
|
1028
|
+
string('This ') {
|
1029
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1030
|
+
color r: 128, g: 0, b: 0, a: 1
|
1031
|
+
}
|
1032
|
+
|
1033
|
+
string('is ') {
|
1034
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1035
|
+
color r: 0, g: 128, b: 0, a: 1
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
string('a ') {
|
1039
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1040
|
+
color r: 0, g: 0, b: 128, a: 1
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
string('short ') {
|
1044
|
+
font size: 20, weight: :bold, italic: :italic, stretch: :normal
|
1045
|
+
color r: 128, g: 128, b: 0, a: 1
|
1046
|
+
}
|
1047
|
+
|
1048
|
+
string('attributed ') {
|
1049
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1050
|
+
color r: 0, g: 128, b: 128, a: 1
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
string("string \n\n") {
|
1054
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1055
|
+
color r: 128, g: 0, b: 128, a: 1
|
1056
|
+
}
|
1057
|
+
|
1007
1058
|
string {
|
1008
1059
|
font family: 'Georgia', size: 13, weight: :medium, italic: :normal, stretch: :normal
|
1009
|
-
color r:
|
1010
|
-
background r:
|
1060
|
+
color r: 0, g: 128, b: 255, a: 1
|
1061
|
+
background r: 255, g: 255, b: 0, a: 0.5
|
1011
1062
|
underline :single
|
1012
1063
|
underline_color :spelling
|
1013
1064
|
open_type_features {
|
@@ -1020,13 +1071,14 @@ window('area text drawing') {
|
|
1020
1071
|
"attributed string\n" \
|
1021
1072
|
"spanning multiple lines\n\n"
|
1022
1073
|
}
|
1023
|
-
|
1024
|
-
string('This is a short unattributed string')
|
1025
1074
|
}
|
1026
1075
|
}
|
1027
1076
|
}.show
|
1028
1077
|
```
|
1029
1078
|
|
1079
|
+
![glimmer-dsl-libui-mac-area-text-drawing.png](/images/glimmer-dsl-libui-mac-area-text-drawing.png)
|
1080
|
+
|
1081
|
+
|
1030
1082
|
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`.
|
1031
1083
|
|
1032
1084
|
Mac | Windows | Linux
|
@@ -1844,6 +1896,8 @@ For Mac, consider [Platypus](https://github.com/sveinbjornt/Platypus) (builds a
|
|
1844
1896
|
|
1845
1897
|
For Linux, simply package your app as a [Ruby Gem](https://guides.rubygems.org/what-is-a-gem/) and [build rpm package from Ruby Gem](https://www.redpill-linpro.com/sysadvent/2015/12/07/building-rpms-from-gems.html) or [build deb package from Ruby Gem](https://openpreservation.org/blogs/building-debian-package-ruby-program/).
|
1846
1898
|
|
1899
|
+
Also, there is a promising project called [ruby-packer](https://github.com/pmq20/ruby-packer) that supports all platforms.
|
1900
|
+
|
1847
1901
|
## Glimmer Style Guide
|
1848
1902
|
|
1849
1903
|
**1 - Control arguments are always wrapped by parentheses.**
|
@@ -5487,7 +5541,7 @@ class ColorTheCircles
|
|
5487
5541
|
|
5488
5542
|
def color_circle(x, y)
|
5489
5543
|
clicked_circle_data = @circles_data.find do |circle_data|
|
5490
|
-
circle_data[:fill].nil? && circle_data[:circle]&.
|
5544
|
+
circle_data[:fill].nil? && circle_data[:circle]&.contain?(x, y)
|
5491
5545
|
end
|
5492
5546
|
if clicked_circle_data
|
5493
5547
|
clicked_circle_data[:fill] = clicked_circle_data[:stroke]
|
@@ -9313,6 +9367,8 @@ TinyMidiPlayer.new
|
|
9313
9367
|
|
9314
9368
|
Snake provides an example of building a desktop application [test-first](/spec/examples/snake/model/game_spec.rb) following the MVP ([Model](/examples/snake/model/game.rb) / [View](/examples/snake.rb) / [Presenter](/examples/snake/presenter/grid.rb)) architectural pattern.
|
9315
9369
|
|
9370
|
+
Use arrows to move and spacebar to pause/resume.
|
9371
|
+
|
9316
9372
|
[examples/snake.rb](examples/snake.rb)
|
9317
9373
|
|
9318
9374
|
Run with this command from the root of the project if you cloned the project:
|
@@ -9553,7 +9609,7 @@ ruby -r glimmer-dsl-libui -e "require 'examples/tetris'"
|
|
9553
9609
|
|
9554
9610
|
Mac | Windows | Linux
|
9555
9611
|
----|---------|------
|
9556
|
-
![glimmer-dsl-libui-mac-tetris.png](images/glimmer-dsl-libui-mac-tetris.png)
|
9612
|
+
![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)
|
9557
9613
|
|
9558
9614
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
9559
9615
|
|
@@ -9631,18 +9687,31 @@ class Tetris
|
|
9631
9687
|
|
9632
9688
|
Model::Game::PREVIEW_PLAYFIELD_HEIGHT.times do |row|
|
9633
9689
|
Model::Game::PREVIEW_PLAYFIELD_WIDTH.times do |column|
|
9634
|
-
|
9690
|
+
preview_updater = proc do
|
9635
9691
|
Glimmer::LibUI.queue_main do
|
9692
|
+
new_color = @game.preview_playfield[row][column].color
|
9636
9693
|
color = Glimmer::LibUI.interpret_color(new_color)
|
9637
9694
|
block = @preview_playfield_blocks[row][column]
|
9638
|
-
|
9639
|
-
|
9640
|
-
|
9641
|
-
|
9642
|
-
|
9643
|
-
|
9695
|
+
if @game.show_preview_tetromino?
|
9696
|
+
block[:background_square].fill = color
|
9697
|
+
block[:top_bevel_edge].fill = {r: color[:r] + 4*BEVEL_CONSTANT, g: color[:g] + 4*BEVEL_CONSTANT, b: color[:b] + 4*BEVEL_CONSTANT}
|
9698
|
+
block[:right_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
9699
|
+
block[:bottom_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
9700
|
+
block[:left_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
9701
|
+
block[:border_square].stroke = new_color == Model::Block::COLOR_CLEAR ? COLOR_GRAY : color
|
9702
|
+
else
|
9703
|
+
transparent_color = {r: 255, g: 255, b: 255, a: 0}
|
9704
|
+
block[:background_square].fill = transparent_color
|
9705
|
+
block[:top_bevel_edge].fill = transparent_color
|
9706
|
+
block[:right_bevel_edge].fill = transparent_color
|
9707
|
+
block[:bottom_bevel_edge].fill = transparent_color
|
9708
|
+
block[:left_bevel_edge].fill = transparent_color
|
9709
|
+
block[:border_square].stroke = transparent_color
|
9710
|
+
end
|
9644
9711
|
end
|
9645
9712
|
end
|
9713
|
+
observe(@game.preview_playfield[row][column], :color, &preview_updater)
|
9714
|
+
observe(@game, :show_preview_tetromino, &preview_updater)
|
9646
9715
|
end
|
9647
9716
|
end
|
9648
9717
|
|
@@ -9690,6 +9759,12 @@ class Tetris
|
|
9690
9759
|
}
|
9691
9760
|
|
9692
9761
|
menu('View') {
|
9762
|
+
check_menu_item('Show Next Block Preview') {
|
9763
|
+
checked <=> [@game, :show_preview_tetromino]
|
9764
|
+
}
|
9765
|
+
|
9766
|
+
separator_menu_item
|
9767
|
+
|
9693
9768
|
menu_item('Show High Scores') {
|
9694
9769
|
on_clicked do
|
9695
9770
|
show_high_scores
|
@@ -9701,18 +9776,20 @@ class Tetris
|
|
9701
9776
|
@game.clear_high_scores!
|
9702
9777
|
}
|
9703
9778
|
}
|
9779
|
+
|
9780
|
+
separator_menu_item
|
9704
9781
|
}
|
9705
9782
|
|
9706
9783
|
menu('Options') {
|
9707
|
-
radio_menu_item('Instant Down on Up Arrow') {
|
9784
|
+
radio_menu_item('Instant Down on Up Arrow') {
|
9708
9785
|
checked <=> [@game, :instant_down_on_up]
|
9709
9786
|
}
|
9710
9787
|
|
9711
|
-
radio_menu_item('Rotate Right on Up Arrow') {
|
9788
|
+
radio_menu_item('Rotate Right on Up Arrow') {
|
9712
9789
|
checked <=> [@game, :rotate_right_on_up]
|
9713
9790
|
}
|
9714
9791
|
|
9715
|
-
radio_menu_item('Rotate Left on Up Arrow') {
|
9792
|
+
radio_menu_item('Rotate Left on Up Arrow') {
|
9716
9793
|
checked <=> [@game, :rotate_left_on_up]
|
9717
9794
|
}
|
9718
9795
|
}
|
@@ -9759,7 +9836,7 @@ class Tetris
|
|
9759
9836
|
block = {}
|
9760
9837
|
bevel_pixel_size = 0.16 * block_size.to_f
|
9761
9838
|
color = Glimmer::LibUI.interpret_color(Model::Block::COLOR_CLEAR)
|
9762
|
-
area {
|
9839
|
+
block[:area] = area {
|
9763
9840
|
block[:background_square] = square(0, 0, block_size) {
|
9764
9841
|
fill color
|
9765
9842
|
}
|
@@ -9835,12 +9912,6 @@ class Tetris
|
|
9835
9912
|
|
9836
9913
|
def score_board(block_size: , &extra_content)
|
9837
9914
|
vertical_box {
|
9838
|
-
horizontal_box {
|
9839
|
-
label # filler
|
9840
|
-
@preview_playfield_blocks = playfield(playfield_width: Model::Game::PREVIEW_PLAYFIELD_WIDTH, playfield_height: Model::Game::PREVIEW_PLAYFIELD_HEIGHT, block_size: block_size)
|
9841
|
-
label # filler
|
9842
|
-
}
|
9843
|
-
|
9844
9915
|
horizontal_box {
|
9845
9916
|
label # filler
|
9846
9917
|
grid {
|
@@ -9881,6 +9952,12 @@ class Tetris
|
|
9881
9952
|
}
|
9882
9953
|
label # filler
|
9883
9954
|
}
|
9955
|
+
|
9956
|
+
horizontal_box {
|
9957
|
+
label # filler
|
9958
|
+
@preview_playfield_blocks = playfield(playfield_width: Model::Game::PREVIEW_PLAYFIELD_WIDTH, playfield_height: Model::Game::PREVIEW_PLAYFIELD_HEIGHT, block_size: block_size)
|
9959
|
+
label # filler
|
9960
|
+
}
|
9884
9961
|
|
9885
9962
|
extra_content&.call
|
9886
9963
|
}
|
@@ -10430,6 +10507,10 @@ https://github.com/AndyObtiva/befunge98/tree/gui
|
|
10430
10507
|
|
10431
10508
|
https://github.com/iraamaro/i3off-gtk-ruby
|
10432
10509
|
|
10510
|
+
### Chess
|
10511
|
+
|
10512
|
+
https://github.com/mikeweber/chess
|
10513
|
+
|
10433
10514
|
## Process
|
10434
10515
|
|
10435
10516
|
[Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.2
|
@@ -81,7 +81,7 @@ class ColorTheCircles
|
|
81
81
|
|
82
82
|
def color_circle(x, y)
|
83
83
|
clicked_circle_data = @circles_data.find do |circle_data|
|
84
|
-
circle_data[:fill].nil? && circle_data[:circle]&.
|
84
|
+
circle_data[:fill].nil? && circle_data[:circle]&.contain?(x, y)
|
85
85
|
end
|
86
86
|
if clicked_circle_data
|
87
87
|
clicked_circle_data[:fill] = clicked_circle_data[:stroke]
|
@@ -36,21 +36,27 @@ class Tetris
|
|
36
36
|
PREVIEW_PLAYFIELD_WIDTH = 4
|
37
37
|
PREVIEW_PLAYFIELD_HEIGHT = 2
|
38
38
|
SCORE_MULTIPLIER = {1 => 40, 2 => 100, 3 => 300, 4 => 1200}
|
39
|
+
UP_ARROW_ACTIONS = %i[instant_down rotate_right rotate_left]
|
40
|
+
SPEEDS = %i[snail sloth turtle rabbit gorilla bear horse gazelle cheetah falcon]
|
41
|
+
SPEED_INITIAL_DELAYS = SPEEDS.each_with_index.inject({}) {|hash, speed_index_pair| hash.merge(speed_index_pair.first => 1.1 - speed_index_pair.last*(0.1)) }
|
39
42
|
|
40
43
|
attr_reader :playfield_width, :playfield_height
|
41
|
-
attr_accessor :game_over, :paused, :preview_tetromino, :lines, :score, :level, :high_scores, :beeping, :added_high_score, :show_high_scores, :up_arrow_action
|
44
|
+
attr_accessor :game_over, :paused, :preview_tetromino, :lines, :score, :level, :high_scores, :beeping, :added_high_score, :show_high_scores, :up_arrow_action, :show_preview_tetromino, :initial_delay
|
42
45
|
alias game_over? game_over
|
43
46
|
alias paused? paused
|
44
47
|
alias beeping? beeping
|
45
48
|
alias added_high_score? added_high_score
|
49
|
+
alias show_preview_tetromino? show_preview_tetromino
|
46
50
|
|
47
51
|
def initialize(playfield_width = PLAYFIELD_WIDTH, playfield_height = PLAYFIELD_HEIGHT)
|
52
|
+
@initial_delay = SPEED_INITIAL_DELAYS[:snail]
|
48
53
|
@playfield_width = playfield_width
|
49
54
|
@playfield_height = playfield_height
|
50
55
|
@high_scores = []
|
51
56
|
@show_high_scores = false
|
52
57
|
@beeping = true
|
53
58
|
@up_arrow_action = :rotate_left
|
59
|
+
@show_preview_tetromino = true
|
54
60
|
load_high_scores!
|
55
61
|
end
|
56
62
|
|
@@ -200,35 +206,31 @@ class Tetris
|
|
200
206
|
end
|
201
207
|
|
202
208
|
def delay
|
203
|
-
[
|
209
|
+
[@initial_delay - (level.to_i * 0.1), 0.001].max
|
204
210
|
end
|
205
211
|
|
206
212
|
def beep
|
207
213
|
@beeper&.call if beeping
|
208
214
|
end
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
def rotate_right_on_up=(value)
|
219
|
-
self.up_arrow_action = :rotate_right if value
|
220
|
-
end
|
221
|
-
|
222
|
-
def rotate_right_on_up
|
223
|
-
self.up_arrow_action == :rotate_right
|
224
|
-
end
|
225
|
-
|
226
|
-
def rotate_left_on_up=(value)
|
227
|
-
self.up_arrow_action = :rotate_left if value
|
215
|
+
|
216
|
+
SPEED_INITIAL_DELAYS.each do |speed, speed_initial_day|
|
217
|
+
define_method("speed_#{speed}=") do |is_true|
|
218
|
+
self.initial_delay = speed_initial_day if is_true
|
219
|
+
end
|
220
|
+
|
221
|
+
define_method("speed_#{speed}") do
|
222
|
+
self.initial_delay == speed_initial_day
|
223
|
+
end
|
228
224
|
end
|
229
225
|
|
230
|
-
|
231
|
-
|
226
|
+
UP_ARROW_ACTIONS.each do |up_arrow_action_symbol|
|
227
|
+
define_method("#{up_arrow_action_symbol}_on_up=") do |is_true|
|
228
|
+
self.up_arrow_action = up_arrow_action_symbol if is_true
|
229
|
+
end
|
230
|
+
|
231
|
+
define_method("#{up_arrow_action_symbol}_on_up") do
|
232
|
+
self.up_arrow_action == up_arrow_action_symbol
|
233
|
+
end
|
232
234
|
end
|
233
235
|
|
234
236
|
def reset_tetrominoes
|
data/examples/tetris.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative 'tetris/model/game'
|
|
5
5
|
class Tetris
|
6
6
|
include Glimmer
|
7
7
|
|
8
|
-
BLOCK_SIZE = 25
|
8
|
+
BLOCK_SIZE = OS.linux? ? 28 : 25
|
9
9
|
BEVEL_CONSTANT = 20
|
10
10
|
COLOR_GRAY = {r: 192, g: 192, b: 192}
|
11
11
|
|
@@ -71,18 +71,31 @@ class Tetris
|
|
71
71
|
|
72
72
|
Model::Game::PREVIEW_PLAYFIELD_HEIGHT.times do |row|
|
73
73
|
Model::Game::PREVIEW_PLAYFIELD_WIDTH.times do |column|
|
74
|
-
|
74
|
+
preview_updater = proc do
|
75
75
|
Glimmer::LibUI.queue_main do
|
76
|
+
new_color = @game.preview_playfield[row][column].color
|
76
77
|
color = Glimmer::LibUI.interpret_color(new_color)
|
77
78
|
block = @preview_playfield_blocks[row][column]
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
if @game.show_preview_tetromino?
|
80
|
+
block[:background_square].fill = color
|
81
|
+
block[:top_bevel_edge].fill = {r: color[:r] + 4*BEVEL_CONSTANT, g: color[:g] + 4*BEVEL_CONSTANT, b: color[:b] + 4*BEVEL_CONSTANT}
|
82
|
+
block[:right_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
83
|
+
block[:bottom_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
84
|
+
block[:left_bevel_edge].fill = {r: color[:r] - BEVEL_CONSTANT, g: color[:g] - BEVEL_CONSTANT, b: color[:b] - BEVEL_CONSTANT}
|
85
|
+
block[:border_square].stroke = new_color == Model::Block::COLOR_CLEAR ? COLOR_GRAY : color
|
86
|
+
else
|
87
|
+
transparent_color = {r: 255, g: 255, b: 255, a: 0}
|
88
|
+
block[:background_square].fill = transparent_color
|
89
|
+
block[:top_bevel_edge].fill = transparent_color
|
90
|
+
block[:right_bevel_edge].fill = transparent_color
|
91
|
+
block[:bottom_bevel_edge].fill = transparent_color
|
92
|
+
block[:left_bevel_edge].fill = transparent_color
|
93
|
+
block[:border_square].stroke = transparent_color
|
94
|
+
end
|
84
95
|
end
|
85
96
|
end
|
97
|
+
observe(@game.preview_playfield[row][column], :color, &preview_updater)
|
98
|
+
observe(@game, :show_preview_tetromino, &preview_updater)
|
86
99
|
end
|
87
100
|
end
|
88
101
|
|
@@ -130,6 +143,12 @@ class Tetris
|
|
130
143
|
}
|
131
144
|
|
132
145
|
menu('View') {
|
146
|
+
check_menu_item('Show Next Block Preview') {
|
147
|
+
checked <=> [@game, :show_preview_tetromino]
|
148
|
+
}
|
149
|
+
|
150
|
+
separator_menu_item
|
151
|
+
|
133
152
|
menu_item('Show High Scores') {
|
134
153
|
on_clicked do
|
135
154
|
show_high_scores
|
@@ -141,18 +160,28 @@ class Tetris
|
|
141
160
|
@game.clear_high_scores!
|
142
161
|
}
|
143
162
|
}
|
163
|
+
|
164
|
+
separator_menu_item
|
165
|
+
}
|
166
|
+
|
167
|
+
menu('Speed') {
|
168
|
+
Model::Game::SPEEDS.each do |speed|
|
169
|
+
radio_menu_item(speed.to_s.capitalize) {
|
170
|
+
checked <=> [@game, "speed_#{speed}"]
|
171
|
+
}
|
172
|
+
end
|
144
173
|
}
|
145
174
|
|
146
175
|
menu('Options') {
|
147
|
-
radio_menu_item('Instant Down on Up Arrow') {
|
176
|
+
radio_menu_item('Instant Down on Up Arrow') {
|
148
177
|
checked <=> [@game, :instant_down_on_up]
|
149
178
|
}
|
150
179
|
|
151
|
-
radio_menu_item('Rotate Right on Up Arrow') {
|
180
|
+
radio_menu_item('Rotate Right on Up Arrow') {
|
152
181
|
checked <=> [@game, :rotate_right_on_up]
|
153
182
|
}
|
154
183
|
|
155
|
-
radio_menu_item('Rotate Left on Up Arrow') {
|
184
|
+
radio_menu_item('Rotate Left on Up Arrow') {
|
156
185
|
checked <=> [@game, :rotate_left_on_up]
|
157
186
|
}
|
158
187
|
}
|
@@ -199,7 +228,7 @@ class Tetris
|
|
199
228
|
block = {}
|
200
229
|
bevel_pixel_size = 0.16 * block_size.to_f
|
201
230
|
color = Glimmer::LibUI.interpret_color(Model::Block::COLOR_CLEAR)
|
202
|
-
area {
|
231
|
+
block[:area] = area {
|
203
232
|
block[:background_square] = square(0, 0, block_size) {
|
204
233
|
fill color
|
205
234
|
}
|
@@ -275,12 +304,6 @@ class Tetris
|
|
275
304
|
|
276
305
|
def score_board(block_size: , &extra_content)
|
277
306
|
vertical_box {
|
278
|
-
horizontal_box {
|
279
|
-
label # filler
|
280
|
-
@preview_playfield_blocks = playfield(playfield_width: Model::Game::PREVIEW_PLAYFIELD_WIDTH, playfield_height: Model::Game::PREVIEW_PLAYFIELD_HEIGHT, block_size: block_size)
|
281
|
-
label # filler
|
282
|
-
}
|
283
|
-
|
284
307
|
horizontal_box {
|
285
308
|
label # filler
|
286
309
|
grid {
|
@@ -321,6 +344,12 @@ class Tetris
|
|
321
344
|
}
|
322
345
|
label # filler
|
323
346
|
}
|
347
|
+
|
348
|
+
horizontal_box {
|
349
|
+
label # filler
|
350
|
+
@preview_playfield_blocks = playfield(playfield_width: Model::Game::PREVIEW_PLAYFIELD_WIDTH, playfield_height: Model::Game::PREVIEW_PLAYFIELD_HEIGHT, block_size: block_size)
|
351
|
+
label # filler
|
352
|
+
}
|
324
353
|
|
325
354
|
extra_content&.call
|
326
355
|
}
|
@@ -329,9 +358,11 @@ class Tetris
|
|
329
358
|
def start_moving_tetrominos_down
|
330
359
|
unless @tetrominos_start_moving_down
|
331
360
|
@tetrominos_start_moving_down = true
|
332
|
-
|
361
|
+
tetromino_move = proc do
|
333
362
|
@game.down! if !@game.game_over? && !@game.paused?
|
363
|
+
Glimmer::LibUI.timer(@game.delay, repeat: false, &tetromino_move)
|
334
364
|
end
|
365
|
+
Glimmer::LibUI.timer(@game.delay, repeat: false, &tetromino_move)
|
335
366
|
end
|
336
367
|
end
|
337
368
|
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -44,6 +44,23 @@ module Glimmer
|
|
44
44
|
end
|
45
45
|
super
|
46
46
|
end
|
47
|
+
|
48
|
+
def perfect_shape
|
49
|
+
perfect_shape_dependencies = [x_center, y_center, radius, start_angle, sweep, is_negative]
|
50
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
51
|
+
x_center, y_center, radius, start_angle, sweep, is_negative = @perfect_shape_dependencies = perfect_shape_dependencies
|
52
|
+
sign = is_negative ? 1 : -1
|
53
|
+
start = is_negative ? (360 - start_angle) : -1*start_angle
|
54
|
+
extent = is_negative ? (360 - sweep) : -1*sweep
|
55
|
+
@perfect_shape = PerfectShape::Arc.new(
|
56
|
+
type: :open,
|
57
|
+
center_x: x_center, center_y: y_center,
|
58
|
+
radius_x: radius, radius_y: radius,
|
59
|
+
start: start, extent: extent
|
60
|
+
)
|
61
|
+
end
|
62
|
+
@perfect_shape
|
63
|
+
end
|
47
64
|
end
|
48
65
|
end
|
49
66
|
end
|
@@ -49,6 +49,15 @@ module Glimmer
|
|
49
49
|
def include_start_point?
|
50
50
|
x && y
|
51
51
|
end
|
52
|
+
|
53
|
+
def perfect_shape
|
54
|
+
perfect_shape_dependencies = [x, y, c1_x, c1_y, c2_x, c2_y, end_x, end_y]
|
55
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
56
|
+
x, y, c1_x, c1_y, c2_x, c2_y, end_x, end_y = @perfect_shape_dependencies = perfect_shape_dependencies
|
57
|
+
@perfect_shape = PerfectShape::CubicBezierCurve.new(points: [[x, y], [c1_x, c1_y], [c2_x, c2_y], [end_x, end_y]])
|
58
|
+
end
|
59
|
+
@perfect_shape
|
60
|
+
end
|
52
61
|
end
|
53
62
|
end
|
54
63
|
end
|
@@ -45,8 +45,13 @@ module Glimmer
|
|
45
45
|
super
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
49
|
-
|
48
|
+
def perfect_shape
|
49
|
+
perfect_shape_dependencies = [x_center, y_center, radius]
|
50
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
51
|
+
x_center, y_center, radius = @perfect_shape_dependencies = perfect_shape_dependencies
|
52
|
+
@perfect_shape = PerfectShape::Circle.new(center_x: x_center, center_y: y_center, radius: radius)
|
53
|
+
end
|
54
|
+
@perfect_shape
|
50
55
|
end
|
51
56
|
end
|
52
57
|
end
|
@@ -52,6 +52,15 @@ module Glimmer
|
|
52
52
|
# start point
|
53
53
|
!parent.is_a?(Figure) && end_x && end_y
|
54
54
|
end
|
55
|
+
|
56
|
+
def perfect_shape
|
57
|
+
perfect_shape_dependencies = [x, y, end_x, end_y]
|
58
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
59
|
+
x, y, end_x, end_y = @perfect_shape_dependencies = perfect_shape_dependencies
|
60
|
+
@perfect_shape = PerfectShape::Line.new(points: [[x, y], [end_x, end_y]])
|
61
|
+
end
|
62
|
+
@perfect_shape
|
63
|
+
end
|
55
64
|
end
|
56
65
|
end
|
57
66
|
end
|
@@ -33,8 +33,13 @@ module Glimmer
|
|
33
33
|
super
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
x
|
36
|
+
def perfect_shape
|
37
|
+
perfect_shape_dependencies = [x, y, width, height]
|
38
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
39
|
+
x, y, width, height = @perfect_shape_dependencies = perfect_shape_dependencies
|
40
|
+
@perfect_shape = PerfectShape::Rectangle.new(x: x, y: y, width: width, height: height)
|
41
|
+
end
|
42
|
+
@perfect_shape
|
38
43
|
end
|
39
44
|
end
|
40
45
|
end
|
@@ -33,8 +33,15 @@ module Glimmer
|
|
33
33
|
super
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
36
|
+
# TODO look into refactoring/unifying code with Rectangle
|
37
|
+
|
38
|
+
def perfect_shape
|
39
|
+
perfect_shape_dependencies = [x, y, length]
|
40
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
41
|
+
@perfect_shape_dependencies = perfect_shape_dependencies
|
42
|
+
@perfect_shape = PerfectShape::Square.new(x: @perfect_shape_dependencies[0], y: @perfect_shape_dependencies[1], length: @perfect_shape_dependencies[2])
|
43
|
+
end
|
44
|
+
@perfect_shape
|
38
45
|
end
|
39
46
|
end
|
40
47
|
end
|
data/lib/glimmer/libui/shape.rb
CHANGED
@@ -145,6 +145,46 @@ module Glimmer
|
|
145
145
|
end
|
146
146
|
alias transform= transform
|
147
147
|
alias set_transform transform
|
148
|
+
|
149
|
+
# Returns if shape contains point on the inside when outline is false (default)
|
150
|
+
# or if point is on the outline when outline is true
|
151
|
+
# distance_tolerance is used when outline is true to enable a fuzz factor in
|
152
|
+
# determining if a point lies on the outline (e.g. makes it easier to select
|
153
|
+
# a shape by mouse)
|
154
|
+
def contain?(*point, outline: false, distance_tolerance: 0)
|
155
|
+
perfect_shape&.contain?(*point, outline: outline, distance_tolerance: distance_tolerance)
|
156
|
+
end
|
157
|
+
|
158
|
+
# Returns if shape includes point on the inside when filled
|
159
|
+
# or if shape includes point on the outline when stroked
|
160
|
+
def include?(*point)
|
161
|
+
if fill.empty?
|
162
|
+
contain?(*point, outline: true, distance_tolerance: ((stroke[:thickness] || 1) - 1))
|
163
|
+
else
|
164
|
+
contain?(*point)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Returns bounding box Array consisting of
|
169
|
+
# [minx, miny, width, height]
|
170
|
+
def bounding_box
|
171
|
+
perfect_shape_bounding_box = perfect_shape&.bounding_box
|
172
|
+
return if perfect_shape_bounding_box.nil?
|
173
|
+
[
|
174
|
+
perfect_shape_bounding_box.x,
|
175
|
+
perfect_shape_bounding_box.y,
|
176
|
+
perfect_shape_bounding_box.width,
|
177
|
+
perfect_shape_bounding_box.height,
|
178
|
+
]
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns PerfectShape object matching this shape to enable
|
182
|
+
# executing computational geometry algorithms
|
183
|
+
#
|
184
|
+
# Subclasses must implement
|
185
|
+
def perfect_shape
|
186
|
+
# No Op
|
187
|
+
end
|
148
188
|
|
149
189
|
def respond_to?(method_name, *args, &block)
|
150
190
|
self.class.parameters.include?(method_name.to_s.sub(/=$/, '').sub(/^set_/, '').to_sym) or
|
data/lib/glimmer-dsl-libui.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-libui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.6.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.6.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: perfect-shape
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: os
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,14 +78,14 @@ dependencies:
|
|
64
78
|
requirements:
|
65
79
|
- - "~>"
|
66
80
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.0.
|
81
|
+
version: 0.0.14
|
68
82
|
type: :runtime
|
69
83
|
prerelease: false
|
70
84
|
version_requirements: !ruby/object:Gem::Requirement
|
71
85
|
requirements:
|
72
86
|
- - "~>"
|
73
87
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.0.
|
88
|
+
version: 0.0.14
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: chunky_png
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,12 +219,13 @@ dependencies:
|
|
205
219
|
- !ruby/object:Gem::Version
|
206
220
|
version: 0.7.0
|
207
221
|
description: Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI
|
208
|
-
Library) -
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
keyword
|
222
|
+
Library) - Winner of Fukuoka Ruby Award Competition 2022 Special Award - No need
|
223
|
+
to pre-install any prerequisites. Just install the gem and have platform-independent
|
224
|
+
native GUI that just works! Glimmer DSL for LibUI aims to provide declarative DSL
|
225
|
+
syntax that visually maps to GUI control hierarchy, convention over configuration
|
226
|
+
via smart defaults, automation of low-level details, requiring the least amount
|
227
|
+
of syntax possible to build GUI, bidirectional data-binding, and custom keyword
|
228
|
+
support.
|
214
229
|
email: andy.am@gmail.com
|
215
230
|
executables:
|
216
231
|
- girb
|