glimmer-dsl-swt 4.18.1.1 → 4.18.2.4
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 +39 -0
- data/README.md +141 -51
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +12 -4
- data/lib/glimmer/dsl/swt/display_expression.rb +3 -3
- data/lib/glimmer/dsl/swt/property_expression.rb +2 -1
- data/lib/glimmer/rake_task/package.rb +9 -9
- data/lib/glimmer/rake_task/scaffold.rb +4 -3
- data/lib/glimmer/swt/custom/animation.rb +138 -15
- data/lib/glimmer/swt/custom/code_text.rb +2 -1
- data/lib/glimmer/swt/custom/shape.rb +58 -12
- data/lib/glimmer/swt/display_proxy.rb +1 -1
- data/lib/glimmer/swt/layout_data_proxy.rb +3 -3
- data/lib/glimmer/swt/shell_proxy.rb +3 -2
- data/lib/glimmer/swt/widget_proxy.rb +5 -7
- data/lib/glimmer/ui/custom_shell.rb +15 -2
- data/lib/glimmer/ui/custom_widget.rb +11 -9
- data/samples/elaborate/meta_sample.rb +21 -0
- data/samples/elaborate/tetris.rb +108 -0
- data/samples/elaborate/tetris/model/block.rb +48 -0
- data/samples/elaborate/tetris/model/game.rb +185 -0
- data/samples/elaborate/tetris/model/tetromino.rb +313 -0
- data/samples/elaborate/tetris/view/block.rb +42 -0
- data/samples/elaborate/tetris/view/game_over_dialog.rb +72 -0
- data/samples/elaborate/tetris/view/playfield.rb +56 -0
- data/samples/elaborate/tetris/view/score_lane.rb +87 -0
- data/samples/hello/hello_canvas.rb +28 -8
- metadata +24 -14
@@ -0,0 +1,87 @@
|
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require_relative 'block'
|
23
|
+
require_relative 'playfield'
|
24
|
+
|
25
|
+
class Tetris
|
26
|
+
module View
|
27
|
+
class ScoreLane
|
28
|
+
include Glimmer::UI::CustomWidget
|
29
|
+
|
30
|
+
options :block_size
|
31
|
+
|
32
|
+
before_body {
|
33
|
+
@font_name = 'Menlo'
|
34
|
+
@font_height = 32
|
35
|
+
}
|
36
|
+
|
37
|
+
body {
|
38
|
+
composite {
|
39
|
+
row_layout {
|
40
|
+
type :vertical
|
41
|
+
center true
|
42
|
+
fill true
|
43
|
+
margin_width 0
|
44
|
+
margin_right block_size
|
45
|
+
margin_height block_size
|
46
|
+
}
|
47
|
+
label(:center) {
|
48
|
+
text 'Next'
|
49
|
+
font name: @font_name, height: @font_height, style: :bold
|
50
|
+
}
|
51
|
+
playfield(game_playfield: Model::Game.preview_playfield, playfield_width: PREVIEW_PLAYFIELD_WIDTH, playfield_height: PREVIEW_PLAYFIELD_HEIGHT, block_size: BLOCK_SIZE)
|
52
|
+
|
53
|
+
label(:center) {
|
54
|
+
text 'Score'
|
55
|
+
font name: @font_name, height: @font_height, style: :bold
|
56
|
+
}
|
57
|
+
label(:center) {
|
58
|
+
text bind(Model::Game, :score)
|
59
|
+
font height: @font_height
|
60
|
+
}
|
61
|
+
|
62
|
+
label # spacer
|
63
|
+
|
64
|
+
label(:center) {
|
65
|
+
text 'Lines'
|
66
|
+
font name: @font_name, height: @font_height, style: :bold
|
67
|
+
}
|
68
|
+
label(:center) {
|
69
|
+
text bind(Model::Game, :lines)
|
70
|
+
font height: @font_height
|
71
|
+
}
|
72
|
+
|
73
|
+
label # spacer
|
74
|
+
|
75
|
+
label(:center) {
|
76
|
+
text 'Level'
|
77
|
+
font name: @font_name, height: @font_height, style: :bold
|
78
|
+
}
|
79
|
+
label(:center) {
|
80
|
+
text bind(Model::Game, :level)
|
81
|
+
font height: @font_height
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -1,27 +1,48 @@
|
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
include Glimmer
|
2
23
|
|
3
24
|
shell {
|
4
25
|
text 'Hello, Canvas!'
|
5
26
|
minimum_size 320, 400
|
6
27
|
|
7
|
-
canvas {
|
28
|
+
canvas {
|
8
29
|
background :yellow
|
9
30
|
rectangle(0, 0, 220, 400, fill: true) {
|
10
31
|
background :red
|
11
32
|
}
|
12
|
-
|
33
|
+
rectangle(50, 20, 300, 150, 30, 50, round: true, fill: true) {
|
13
34
|
background :magenta
|
14
35
|
}
|
15
|
-
|
36
|
+
rectangle(150, 200, 100, 70, true, gradient: true) {
|
16
37
|
background :dark_magenta
|
17
38
|
foreground :yellow
|
18
39
|
}
|
19
|
-
|
40
|
+
rectangle(50, 200, 30, 70, false, gradient: true) {
|
20
41
|
background :magenta
|
21
42
|
foreground :dark_blue
|
22
43
|
}
|
23
44
|
rectangle(205, 50, 88, 96) {
|
24
|
-
foreground
|
45
|
+
foreground :yellow
|
25
46
|
}
|
26
47
|
text('Picasso', 60, 80) {
|
27
48
|
background :yellow
|
@@ -34,10 +55,9 @@ shell {
|
|
34
55
|
arc(210, 210, 100, 100, 30, -77, fill: true) {
|
35
56
|
background :red
|
36
57
|
}
|
37
|
-
polygon(250, 210, 260, 170, 270, 210, 290, 230,
|
58
|
+
polygon(250, 210, 260, 170, 270, 210, 290, 230, fill: true) {
|
38
59
|
background :dark_yellow
|
39
|
-
foreground :yellow
|
40
60
|
}
|
41
|
-
|
61
|
+
polyline(250, 110, 260, 70, 270, 110, 290, 130, 250, 110)
|
42
62
|
}
|
43
63
|
}.open
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.18.
|
4
|
+
version: 4.18.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -330,18 +330,20 @@ dependencies:
|
|
330
330
|
version: 0.7.0
|
331
331
|
description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a native-GUI
|
332
332
|
cross-platform desktop development library written in JRuby, an OS-threaded faster
|
333
|
-
version of Ruby. Glimmer's main innovation is a declarative Ruby DSL that enables
|
334
|
-
productive and efficient authoring of desktop application user-interfaces
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
333
|
+
JVM version of Ruby. Glimmer's main innovation is a declarative Ruby DSL that enables
|
334
|
+
productive and efficient authoring of desktop application user-interfaces by relying
|
335
|
+
on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in
|
336
|
+
data-binding support, which greatly facilitates synchronizing the GUI with domain
|
337
|
+
models, thus achieving true decoupling of object oriented components and enabling
|
338
|
+
developers to solve business problems (test-first) without worrying about GUI concerns,
|
339
|
+
or alternatively drive development GUI-first, and then write clean business models
|
340
|
+
(test-first) afterwards. Not only does Glimmer provide a large set of GUI widgets,
|
341
|
+
but it also supports drawing Canvas Graphics like Shapes and Animations. To get
|
342
|
+
started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets.
|
343
|
+
Glimmer also includes native-executable packaging support, sorely lacking in other
|
344
|
+
libraries, thus enabling the delivery of desktop apps written in Ruby as truly native
|
345
|
+
DMG/PKG/APP files on the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged
|
346
|
+
Shell Scripts on Linux.
|
345
347
|
email: andy.am@gmail.com
|
346
348
|
executables:
|
347
349
|
- glimmer
|
@@ -463,6 +465,14 @@ files:
|
|
463
465
|
- samples/elaborate/contact_manager/contact_repository.rb
|
464
466
|
- samples/elaborate/login.rb
|
465
467
|
- samples/elaborate/meta_sample.rb
|
468
|
+
- samples/elaborate/tetris.rb
|
469
|
+
- samples/elaborate/tetris/model/block.rb
|
470
|
+
- samples/elaborate/tetris/model/game.rb
|
471
|
+
- samples/elaborate/tetris/model/tetromino.rb
|
472
|
+
- samples/elaborate/tetris/view/block.rb
|
473
|
+
- samples/elaborate/tetris/view/game_over_dialog.rb
|
474
|
+
- samples/elaborate/tetris/view/playfield.rb
|
475
|
+
- samples/elaborate/tetris/view/score_lane.rb
|
466
476
|
- samples/elaborate/tic_tac_toe.rb
|
467
477
|
- samples/elaborate/tic_tac_toe/board.rb
|
468
478
|
- samples/elaborate/tic_tac_toe/cell.rb
|