glimmer-dsl-swt 4.18.1.1 → 4.18.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 { |prox|
28
+ canvas {
8
29
  background :yellow
9
30
  rectangle(0, 0, 220, 400, fill: true) {
10
31
  background :red
11
32
  }
12
- round_rectangle(50, 20, 300, 150, 30, 50, fill: true) {
33
+ rectangle(50, 20, 300, 150, 30, 50, round: true, fill: true) {
13
34
  background :magenta
14
35
  }
15
- gradient_rectangle(150, 200, 100, 70, true, fill: true) {
36
+ rectangle(150, 200, 100, 70, true, gradient: true) {
16
37
  background :dark_magenta
17
38
  foreground :yellow
18
39
  }
19
- gradient_rectangle(50, 200, 30, 70, false, fill: true) {
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 color(:yellow)
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, 250, 210, fill: true) {
58
+ polygon(250, 210, 260, 170, 270, 210, 290, 230, fill: true) {
38
59
  background :dark_yellow
39
- foreground :yellow
40
60
  }
41
- polygon(250, 110, 260, 70, 270, 110, 290, 130, 250, 110)
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.1.1
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-20 00:00:00.000000000 Z
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 while
335
- relying on the robust Eclipse SWT library. Glimmer additionally innovates by having
336
- built-in data-binding support, which greatly facilitates synchronizing the GUI with
337
- domain models, thus achieving true decoupling of object oriented components and
338
- enabling developers to solve business problems (test-first) without worrying about
339
- GUI concerns, or alternatively drive development GUI-first, and then write clean
340
- business models (test-first) afterwards. To get started quickly, Glimmer offers
341
- scaffolding options for Apps, Gems, and Custom Widgets. Glimmer also includes native-executable
342
- packaging support, sorely lacking in other libraries, thus enabling the delivery
343
- of desktop apps written in Ruby as truly native DMG/PKG/APP files on the Mac + App
344
- Store, MSI/EXE files on Windows, and Gem Packaged Shell Scripts on Linux.
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