glimmer-dsl-swt 4.18.2.0 → 4.18.2.5
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 +37 -0
- data/README.md +65 -22
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +15 -7
- data/lib/glimmer/dsl/swt/color_expression.rb +4 -4
- data/lib/glimmer/dsl/swt/data_binding_expression.rb +3 -3
- data/lib/glimmer/dsl/swt/display_expression.rb +3 -3
- data/lib/glimmer/dsl/swt/property_expression.rb +2 -1
- data/lib/glimmer/dsl/swt/shape_expression.rb +2 -4
- data/lib/glimmer/dsl/swt/widget_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/color_proxy.rb +28 -6
- data/lib/glimmer/swt/custom/drawable.rb +8 -0
- data/lib/glimmer/swt/custom/shape.rb +62 -25
- 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 +4 -3
- data/lib/glimmer/swt/widget_proxy.rb +34 -25
- data/lib/glimmer/ui/custom_shell.rb +15 -2
- data/lib/glimmer/ui/custom_widget.rb +44 -31
- data/samples/elaborate/meta_sample.rb +21 -0
- data/samples/elaborate/tetris.rb +106 -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 +70 -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
- metadata +15 -7
@@ -0,0 +1,56 @@
|
|
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
|
+
|
24
|
+
class Tetris
|
25
|
+
module View
|
26
|
+
class Playfield
|
27
|
+
include Glimmer::UI::CustomWidget
|
28
|
+
|
29
|
+
options :game_playfield, :playfield_width, :playfield_height, :block_size
|
30
|
+
|
31
|
+
body {
|
32
|
+
canvas {
|
33
|
+
grid_layout {
|
34
|
+
num_columns playfield_width
|
35
|
+
make_columns_equal_width true
|
36
|
+
margin_width block_size
|
37
|
+
margin_height block_size
|
38
|
+
horizontal_spacing 0
|
39
|
+
vertical_spacing 0
|
40
|
+
}
|
41
|
+
|
42
|
+
playfield_height.times { |row|
|
43
|
+
playfield_width.times { |column|
|
44
|
+
block(game_playfield: game_playfield, block_size: block_size, row: row, column: column) {
|
45
|
+
layout_data {
|
46
|
+
width_hint block_size
|
47
|
+
height_hint block_size
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -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
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.18.2.
|
4
|
+
version: 4.18.2.5
|
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
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 1.0.
|
18
|
+
version: 1.0.9
|
19
19
|
name: glimmer
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0.
|
26
|
+
version: 1.0.9
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -330,7 +330,7 @@ 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
|
333
|
+
JVM version of Ruby. Glimmer's main innovation is a declarative Ruby DSL that enables
|
334
334
|
productive and efficient authoring of desktop application user-interfaces by relying
|
335
335
|
on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in
|
336
336
|
data-binding support, which greatly facilitates synchronizing the GUI with domain
|
@@ -338,8 +338,8 @@ description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a
|
|
338
338
|
developers to solve business problems (test-first) without worrying about GUI concerns,
|
339
339
|
or alternatively drive development GUI-first, and then write clean business models
|
340
340
|
(test-first) afterwards. Not only does Glimmer provide a large set of GUI widgets,
|
341
|
-
but also supports drawing Canvas Graphics like Shapes and Animations. To get
|
342
|
-
quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom 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
343
|
Glimmer also includes native-executable packaging support, sorely lacking in other
|
344
344
|
libraries, thus enabling the delivery of desktop apps written in Ruby as truly native
|
345
345
|
DMG/PKG/APP files on the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged
|
@@ -465,6 +465,14 @@ files:
|
|
465
465
|
- samples/elaborate/contact_manager/contact_repository.rb
|
466
466
|
- samples/elaborate/login.rb
|
467
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
|
468
476
|
- samples/elaborate/tic_tac_toe.rb
|
469
477
|
- samples/elaborate/tic_tac_toe/board.rb
|
470
478
|
- samples/elaborate/tic_tac_toe/cell.rb
|