glimmer-dsl-libui 0.4.22 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +44 -7
- data/VERSION +1 -1
- data/glimmer-dsl-libui.gemspec +0 -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 +36 -0
- data/lib/glimmer-dsl-libui.rb +1 -0
- metadata +25 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40d0cbf805427a73645a86c95d7fa1c36f030c24ca6a19b1273f7b37c2426f05
|
4
|
+
data.tar.gz: f8e728ea7b9e8b3a4393e8ba02d2958b5330d8d4292ed694a8ed02b0b651a1c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b79c4c8bb0138fb0059cd9bc0a9dfd5327245214c1eb1c4270c914b31065f832d065b73a6f365643eb7807c92420ed222ee91b8324dfde599c8047d6d2fc45ff
|
7
|
+
data.tar.gz: c2583ac2d4f84aa26f8a6528e49392c1bc2e7fea908f62787bf9378929093adc1e4058450e687e5d61cbf2ed58157b59a34300d70a1f44ea4714f757324fb399
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.5.0
|
4
|
+
|
5
|
+
- Upgrade to glimmer 2.6.0
|
6
|
+
- 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?)
|
7
|
+
- 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?)
|
8
|
+
|
3
9
|
## 0.4.22
|
4
10
|
|
5
11
|
- examples/tetris.rb "Show Next Block Preview" menu item under "View" menu
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.
|
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.0
|
2
2
|
## Prerequisite-Free Ruby Desktop Development GUI Library
|
3
3
|
[](http://badge.fury.io/rb/glimmer-dsl-libui)
|
4
4
|
[](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
@@ -330,7 +330,7 @@ Mac | Windows | Linux
|
|
330
330
|
|
331
331
|

|
332
332
|
|
333
|
-
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.
|
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
334
|
|
335
335
|
**[Glimmer](https://rubygems.org/gems/glimmer) DSL Comparison Table:**
|
336
336
|
DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
@@ -519,7 +519,7 @@ gem install glimmer-dsl-libui
|
|
519
519
|
Or install via Bundler `Gemfile`:
|
520
520
|
|
521
521
|
```ruby
|
522
|
-
gem 'glimmer-dsl-libui', '~> 0.
|
522
|
+
gem 'glimmer-dsl-libui', '~> 0.5.0'
|
523
523
|
```
|
524
524
|
|
525
525
|
Test that installation worked by running the [Meta-Example](#examples):
|
@@ -1008,15 +1008,49 @@ To draw `text` in an `area`, you simply nest a `text(x, y, width)` control direc
|
|
1008
1008
|
Example (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
1009
1009
|
|
1010
1010
|
```ruby
|
1011
|
+
require 'glimmer-dsl-libui'
|
1012
|
+
|
1013
|
+
include Glimmer
|
1014
|
+
|
1011
1015
|
window('area text drawing') {
|
1012
1016
|
area {
|
1013
1017
|
text {
|
1014
1018
|
default_font family: 'Helvetica', size: 12, weight: :normal, italic: :normal, stretch: :normal
|
1015
1019
|
|
1020
|
+
string('This ') {
|
1021
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1022
|
+
color r: 128, g: 0, b: 0, a: 1
|
1023
|
+
}
|
1024
|
+
|
1025
|
+
string('is ') {
|
1026
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1027
|
+
color r: 0, g: 128, b: 0, a: 1
|
1028
|
+
}
|
1029
|
+
|
1030
|
+
string('a ') {
|
1031
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1032
|
+
color r: 0, g: 0, b: 128, a: 1
|
1033
|
+
}
|
1034
|
+
|
1035
|
+
string('short ') {
|
1036
|
+
font size: 20, weight: :bold, italic: :italic, stretch: :normal
|
1037
|
+
color r: 128, g: 128, b: 0, a: 1
|
1038
|
+
}
|
1039
|
+
|
1040
|
+
string('attributed ') {
|
1041
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1042
|
+
color r: 0, g: 128, b: 128, a: 1
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
string("string \n\n") {
|
1046
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1047
|
+
color r: 128, g: 0, b: 128, a: 1
|
1048
|
+
}
|
1049
|
+
|
1016
1050
|
string {
|
1017
1051
|
font family: 'Georgia', size: 13, weight: :medium, italic: :normal, stretch: :normal
|
1018
|
-
color r:
|
1019
|
-
background r:
|
1052
|
+
color r: 0, g: 128, b: 255, a: 1
|
1053
|
+
background r: 255, g: 255, b: 0, a: 0.5
|
1020
1054
|
underline :single
|
1021
1055
|
underline_color :spelling
|
1022
1056
|
open_type_features {
|
@@ -1029,13 +1063,14 @@ window('area text drawing') {
|
|
1029
1063
|
"attributed string\n" \
|
1030
1064
|
"spanning multiple lines\n\n"
|
1031
1065
|
}
|
1032
|
-
|
1033
|
-
string('This is a short unattributed string')
|
1034
1066
|
}
|
1035
1067
|
}
|
1036
1068
|
}.show
|
1037
1069
|
```
|
1038
1070
|
|
1071
|
+

|
1072
|
+
|
1073
|
+
|
1039
1074
|
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`.
|
1040
1075
|
|
1041
1076
|
Mac | Windows | Linux
|
@@ -1853,6 +1888,8 @@ For Mac, consider [Platypus](https://github.com/sveinbjornt/Platypus) (builds a
|
|
1853
1888
|
|
1854
1889
|
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/).
|
1855
1890
|
|
1891
|
+
Also, there is a promising project called [ruby-packer](https://github.com/pmq20/ruby-packer) that supports all platforms.
|
1892
|
+
|
1856
1893
|
## Glimmer Style Guide
|
1857
1894
|
|
1858
1895
|
**1 - Control arguments are always wrapped by parentheses.**
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -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
|
+
@perfect_shape_dependencies = perfect_shape_dependencies
|
40
|
+
@perfect_shape = PerfectShape::Rectangle.new(x: @perfect_shape_dependencies[0], y: @perfect_shape_dependencies[1], width: @perfect_shape_dependencies[2], height: @perfect_shape_dependencies[3])
|
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,42 @@ 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
|
150
|
+
def contain?(*point)
|
151
|
+
perfect_shape&.contain?(*point)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Returns if shape includes point on the inside when filled
|
155
|
+
# or if shape includes point on the outline when stroked
|
156
|
+
def include?(*point)
|
157
|
+
if fill.empty?
|
158
|
+
perfect_shape&.contain?(*point, outline: true, distance_tolerance: ((stroke[:thickness] || 1) - 1))
|
159
|
+
else
|
160
|
+
perfect_shape&.contain?(*point)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# Returns bounding box Array consisting of
|
165
|
+
# [minx, miny, width, height]
|
166
|
+
def bounding_box
|
167
|
+
perfect_shape_bounding_box = perfect_shape&.bounding_box
|
168
|
+
return if perfect_shape_bounding_box.nil?
|
169
|
+
[
|
170
|
+
perfect_shape_bounding_box.x,
|
171
|
+
perfect_shape_bounding_box.y,
|
172
|
+
perfect_shape_bounding_box.width,
|
173
|
+
perfect_shape_bounding_box.height,
|
174
|
+
]
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns PerfectShape object matching this shape to enable
|
178
|
+
# executing computational geometry algorithms
|
179
|
+
#
|
180
|
+
# Subclasses must implement
|
181
|
+
def perfect_shape
|
182
|
+
# No Op
|
183
|
+
end
|
148
184
|
|
149
185
|
def respond_to?(method_name, *args, &block)
|
150
186
|
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.0
|
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-02-
|
11
|
+
date: 2022-02-13 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.0
|
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.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: os
|
29
43
|
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
|