glimmer-dsl-gtk 0.0.2 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -0
- data/README.md +1072 -27
- data/VERSION +1 -1
- data/glimmer-dsl-gtk.gemspec +0 -0
- data/images/breaking-blue-wave.png +0 -0
- data/lib/glimmer/dsl/gtk/observe_expression.rb +35 -0
- data/lib/glimmer/gtk/shape/arc_negative.rb +70 -0
- data/lib/glimmer/gtk/shape/path.rb +33 -0
- data/lib/glimmer/gtk/shape/square.rb +76 -0
- data/lib/glimmer/gtk/shape.rb +56 -10
- data/lib/glimmer/gtk/transformable.rb +93 -0
- data/lib/glimmer/gtk/widget_proxy/drawing_area_proxy.rb +16 -0
- data/lib/glimmer/gtk/widget_proxy.rb +2 -2
- data/samples/cairo/arc.rb +44 -0
- data/samples/cairo/arc_negative.rb +44 -0
- data/samples/cairo/clip.rb +34 -0
- data/samples/cairo/clip_image.rb +28 -0
- data/samples/cairo/curve_to.rb +39 -0
- data/samples/cairo/dashes.rb +30 -0
- data/samples/cairo/fill_and_stroke2.rb +36 -0
- data/samples/cairo/fill_style.rb +43 -0
- data/samples/cairo/gradient.rb +31 -0
- data/samples/cairo/image.rb +23 -0
- data/samples/cairo/image_gradient.rb +32 -0
- data/samples/cairo/multi_segment_caps.rb +27 -0
- data/samples/cairo/rounded_rectangle.rb +20 -0
- data/samples/cairo/set_line_cap.rb +53 -0
- data/samples/cairo/set_line_join.rb +43 -0
- data/samples/elaborate/tetris/model/block.rb +48 -0
- data/samples/elaborate/tetris/model/game.rb +320 -0
- data/samples/elaborate/tetris/model/past_game.rb +39 -0
- data/samples/elaborate/tetris/model/tetromino.rb +329 -0
- data/samples/elaborate/tetris.rb +338 -0
- data/samples/hello/hello_drawing_area.rb +1 -3
- data/samples/hello/hello_drawing_area_manual.rb +20 -21
- metadata +29 -4
@@ -0,0 +1,338 @@
|
|
1
|
+
require 'glimmer-dsl-gtk'
|
2
|
+
|
3
|
+
require_relative 'tetris/model/game'
|
4
|
+
|
5
|
+
class Tetris
|
6
|
+
include Glimmer
|
7
|
+
|
8
|
+
BLOCK_SIZE = 25
|
9
|
+
BEVEL_CONSTANT = 20
|
10
|
+
COLOR_GRAY = [192, 192, 192]
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@game = Model::Game.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def launch
|
17
|
+
create_gui
|
18
|
+
register_observers
|
19
|
+
@game.start!
|
20
|
+
@main_window.show
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_gui
|
24
|
+
@main_window = window {
|
25
|
+
title 'Glimmer Tetris'
|
26
|
+
default_size Model::Game::PLAYFIELD_WIDTH * BLOCK_SIZE, Model::Game::PLAYFIELD_HEIGHT * BLOCK_SIZE # + 98
|
27
|
+
|
28
|
+
box(:vertical) {
|
29
|
+
tetris_menu_bar
|
30
|
+
|
31
|
+
box(:horizontal) {
|
32
|
+
@playfield_blocks = playfield(playfield_width: @game.playfield_width, playfield_height: @game.playfield_height, block_size: BLOCK_SIZE)
|
33
|
+
|
34
|
+
score_board
|
35
|
+
}
|
36
|
+
|
37
|
+
}
|
38
|
+
|
39
|
+
on(:key_press_event) do |widget, key_event|
|
40
|
+
case key_event.keyval
|
41
|
+
when 65364 # down arrow
|
42
|
+
@game.down!
|
43
|
+
when 32 # space
|
44
|
+
@game.down!(instant: true)
|
45
|
+
when 65362 # up arrow
|
46
|
+
case @game.up_arrow_action
|
47
|
+
when :instant_down
|
48
|
+
@game.down!(instant: true)
|
49
|
+
when :rotate_right
|
50
|
+
@game.rotate!(:right)
|
51
|
+
when :rotate_left
|
52
|
+
@game.rotate!(:left)
|
53
|
+
end
|
54
|
+
when 65361 # left arrow
|
55
|
+
@game.left!
|
56
|
+
when 65363 # right arrow
|
57
|
+
@game.right!
|
58
|
+
when 65506 # right shift
|
59
|
+
@game.rotate!(:right)
|
60
|
+
when 65505 # left shift
|
61
|
+
@game.rotate!(:left)
|
62
|
+
else
|
63
|
+
# Do Nothing
|
64
|
+
end
|
65
|
+
end
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def register_observers
|
70
|
+
observe(@game, :game_over) do |game_over|
|
71
|
+
if game_over
|
72
|
+
show_game_over_dialog
|
73
|
+
else
|
74
|
+
start_moving_tetrominos_down
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
@game.playfield_height.times do |row|
|
79
|
+
@game.playfield_width.times do |column|
|
80
|
+
observe(@game.playfield[row][column], :color) do |new_color|
|
81
|
+
color = new_color
|
82
|
+
block = @playfield_blocks[row][column]
|
83
|
+
block[:background_square].fill = color
|
84
|
+
block[:top_bevel_edge].fill = [color[0] + 4*BEVEL_CONSTANT, color[1] + 4*BEVEL_CONSTANT, color[2] + 4*BEVEL_CONSTANT]
|
85
|
+
block[:right_bevel_edge].fill = [color[0] - BEVEL_CONSTANT, color[1] - BEVEL_CONSTANT, color[2] - BEVEL_CONSTANT]
|
86
|
+
block[:bottom_bevel_edge].fill = [color[0] - BEVEL_CONSTANT, color[1] - BEVEL_CONSTANT, color[2] - BEVEL_CONSTANT]
|
87
|
+
block[:left_bevel_edge].fill = [color[0] - BEVEL_CONSTANT, color[1] - BEVEL_CONSTANT, color[2] - BEVEL_CONSTANT]
|
88
|
+
block[:border_square].stroke = new_color == Model::Block::COLOR_CLEAR ? COLOR_GRAY : color
|
89
|
+
block[:drawing_area].queue_draw
|
90
|
+
false
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
Model::Game::PREVIEW_PLAYFIELD_HEIGHT.times do |row|
|
96
|
+
Model::Game::PREVIEW_PLAYFIELD_WIDTH.times do |column|
|
97
|
+
observe(@game.preview_playfield[row][column], :color) do |new_color|
|
98
|
+
color = new_color
|
99
|
+
block = @preview_playfield_blocks[row][column]
|
100
|
+
block[:background_square].fill = color
|
101
|
+
block[:top_bevel_edge].fill = [color[0] + 4*BEVEL_CONSTANT, color[1] + 4*BEVEL_CONSTANT, color[2] + 4*BEVEL_CONSTANT]
|
102
|
+
block[:right_bevel_edge].fill = [color[0] - BEVEL_CONSTANT, color[1] - BEVEL_CONSTANT, color[2] - BEVEL_CONSTANT]
|
103
|
+
block[:bottom_bevel_edge].fill = [color[0] - BEVEL_CONSTANT, color[1] - BEVEL_CONSTANT, color[2] - BEVEL_CONSTANT]
|
104
|
+
block[:left_bevel_edge].fill = [color[0] - BEVEL_CONSTANT, color[1] - BEVEL_CONSTANT, color[2] - BEVEL_CONSTANT]
|
105
|
+
block[:border_square].stroke = new_color == Model::Block::COLOR_CLEAR ? COLOR_GRAY : color
|
106
|
+
block[:drawing_area].queue_draw
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
observe(@game, :score) do |new_score|
|
112
|
+
@score_label.text = new_score.to_s
|
113
|
+
end
|
114
|
+
|
115
|
+
observe(@game, :lines) do |new_lines|
|
116
|
+
@lines_label.text = new_lines.to_s
|
117
|
+
end
|
118
|
+
|
119
|
+
observe(@game, :level) do |new_level|
|
120
|
+
@level_label.text = new_level.to_s
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def tetris_menu_bar
|
125
|
+
menu_bar {
|
126
|
+
menu_item(label: 'Game') { |mi|
|
127
|
+
m = menu {
|
128
|
+
check_menu_item(label: 'Pause') {
|
129
|
+
on(:activate) do
|
130
|
+
@game.paused = !@game.paused?
|
131
|
+
end
|
132
|
+
}
|
133
|
+
|
134
|
+
menu_item(label: 'Restart') {
|
135
|
+
on(:activate) do
|
136
|
+
@game.restart!
|
137
|
+
end
|
138
|
+
}
|
139
|
+
|
140
|
+
separator_menu_item
|
141
|
+
|
142
|
+
menu_item(label: 'Exit') {
|
143
|
+
on(:activate) do
|
144
|
+
@main_window.close
|
145
|
+
end
|
146
|
+
}
|
147
|
+
}
|
148
|
+
mi.submenu = m.gtk
|
149
|
+
}
|
150
|
+
|
151
|
+
menu_item(label: 'View') { |mi|
|
152
|
+
m = menu {
|
153
|
+
menu_item(label: 'Show High Scores') {
|
154
|
+
on(:activate) do
|
155
|
+
show_high_score_dialog
|
156
|
+
end
|
157
|
+
}
|
158
|
+
|
159
|
+
menu_item(label: 'Clear High Scores') {
|
160
|
+
on(:activate) do
|
161
|
+
@game.clear_high_scores!
|
162
|
+
end
|
163
|
+
}
|
164
|
+
}
|
165
|
+
mi.submenu = m.gtk
|
166
|
+
}
|
167
|
+
|
168
|
+
menu_item(label: 'Options') { |mi|
|
169
|
+
m = menu {
|
170
|
+
rmi = radio_menu_item(nil, 'Instant Down on Up') {
|
171
|
+
on(:activate) do
|
172
|
+
@game.instant_down_on_up!
|
173
|
+
end
|
174
|
+
}
|
175
|
+
|
176
|
+
default_rmi = radio_menu_item(rmi.group, 'Rotate Right on Up') {
|
177
|
+
on(:activate) do
|
178
|
+
@game.rotate_right_on_up!
|
179
|
+
end
|
180
|
+
}
|
181
|
+
default_rmi.activate
|
182
|
+
|
183
|
+
radio_menu_item(rmi.group, 'Rotate Left on Up') {
|
184
|
+
on(:activate) do
|
185
|
+
@game.rotate_left_on_up!
|
186
|
+
end
|
187
|
+
}
|
188
|
+
}
|
189
|
+
mi.submenu = m.gtk
|
190
|
+
}
|
191
|
+
|
192
|
+
menu_item(label: 'Options') { |mi|
|
193
|
+
m = menu {
|
194
|
+
menu_item(label: 'About') {
|
195
|
+
on(:activate) do
|
196
|
+
show_about_dialog
|
197
|
+
end
|
198
|
+
}
|
199
|
+
}
|
200
|
+
mi.submenu = m.gtk
|
201
|
+
}
|
202
|
+
}
|
203
|
+
end
|
204
|
+
|
205
|
+
def score_board
|
206
|
+
box(:vertical) {
|
207
|
+
label
|
208
|
+
@preview_playfield_blocks = playfield(playfield_width: Model::Game::PREVIEW_PLAYFIELD_WIDTH, playfield_height: Model::Game::PREVIEW_PLAYFIELD_HEIGHT, block_size: BLOCK_SIZE)
|
209
|
+
|
210
|
+
label
|
211
|
+
label('Score')
|
212
|
+
@score_label = label
|
213
|
+
|
214
|
+
label
|
215
|
+
label('Lines')
|
216
|
+
@lines_label = label
|
217
|
+
|
218
|
+
label
|
219
|
+
label('Level')
|
220
|
+
@level_label = label
|
221
|
+
label
|
222
|
+
}
|
223
|
+
end
|
224
|
+
|
225
|
+
def playfield(playfield_width: , playfield_height: , block_size: , &extra_content)
|
226
|
+
blocks = []
|
227
|
+
box(:vertical) {
|
228
|
+
playfield_height.times.map do |row|
|
229
|
+
blocks << []
|
230
|
+
box(:horizontal) {
|
231
|
+
playfield_width.times.map do |column|
|
232
|
+
blocks.last << block(row: row, column: column, block_size: block_size)
|
233
|
+
end
|
234
|
+
}
|
235
|
+
end
|
236
|
+
|
237
|
+
extra_content&.call
|
238
|
+
}
|
239
|
+
blocks
|
240
|
+
end
|
241
|
+
|
242
|
+
def block(row: , column: , block_size: , &extra_content)
|
243
|
+
block = {}
|
244
|
+
bevel_pixel_size = 0.16 * block_size.to_f
|
245
|
+
color = Model::Block::COLOR_CLEAR
|
246
|
+
block[:drawing_area] = drawing_area {
|
247
|
+
size_request block_size, block_size
|
248
|
+
|
249
|
+
block[:background_square] = square(0, 0, block_size) {
|
250
|
+
fill *color
|
251
|
+
}
|
252
|
+
|
253
|
+
block[:top_bevel_edge] = polygon(0, 0, block_size, 0, block_size - bevel_pixel_size, bevel_pixel_size, bevel_pixel_size, bevel_pixel_size) {
|
254
|
+
fill color[0] + 4*BEVEL_CONSTANT, color[1] + 4*BEVEL_CONSTANT, color[2] + 4*BEVEL_CONSTANT
|
255
|
+
}
|
256
|
+
|
257
|
+
block[:right_bevel_edge] = polygon(block_size, 0, block_size - bevel_pixel_size, bevel_pixel_size, block_size - bevel_pixel_size, block_size - bevel_pixel_size, block_size, block_size) {
|
258
|
+
fill color[0] - BEVEL_CONSTANT, color[1] - BEVEL_CONSTANT, color[2] - BEVEL_CONSTANT
|
259
|
+
}
|
260
|
+
|
261
|
+
block[:bottom_bevel_edge] = polygon(block_size, block_size, 0, block_size, bevel_pixel_size, block_size - bevel_pixel_size, block_size - bevel_pixel_size, block_size - bevel_pixel_size) {
|
262
|
+
fill color[0] - BEVEL_CONSTANT, color[1] - BEVEL_CONSTANT, color[2] - BEVEL_CONSTANT
|
263
|
+
}
|
264
|
+
|
265
|
+
block[:left_bevel_edge] = polygon(0, 0, 0, block_size, bevel_pixel_size, block_size - bevel_pixel_size, bevel_pixel_size, bevel_pixel_size) {
|
266
|
+
fill color[0] - BEVEL_CONSTANT, color[1] - BEVEL_CONSTANT, color[2] - BEVEL_CONSTANT
|
267
|
+
}
|
268
|
+
|
269
|
+
block[:border_square] = square(0, 0, block_size) {
|
270
|
+
stroke *COLOR_GRAY
|
271
|
+
}
|
272
|
+
|
273
|
+
extra_content&.call
|
274
|
+
}
|
275
|
+
block
|
276
|
+
end
|
277
|
+
|
278
|
+
def start_moving_tetrominos_down
|
279
|
+
unless @tetrominos_start_moving_down
|
280
|
+
@tetrominos_start_moving_down = true
|
281
|
+
GLib::Timeout.add(@game.delay*1000) do
|
282
|
+
@game.down! if !@game.game_over? && !@game.paused?
|
283
|
+
true
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
def show_game_over_dialog
|
289
|
+
message_dialog(@main_window) { |md|
|
290
|
+
title 'Game Over!'
|
291
|
+
text "Score: #{@game.high_scores.first.score}\nLines: #{@game.high_scores.first.lines}\nLevel: #{@game.high_scores.first.level}"
|
292
|
+
|
293
|
+
on(:response) do
|
294
|
+
md.destroy
|
295
|
+
end
|
296
|
+
}.show
|
297
|
+
|
298
|
+
@game.restart!
|
299
|
+
false
|
300
|
+
end
|
301
|
+
|
302
|
+
def show_high_score_dialog
|
303
|
+
game_paused = !!@game.paused
|
304
|
+
@game.paused = true
|
305
|
+
|
306
|
+
if @game.high_scores.empty?
|
307
|
+
high_scores_string = "No games have been scored yet."
|
308
|
+
else
|
309
|
+
high_scores_string = @game.high_scores.map do |high_score|
|
310
|
+
"#{high_score.name} | Score: #{high_score.score} | Lines: #{high_score.lines} | Level: #{high_score.level}"
|
311
|
+
end.join("\n")
|
312
|
+
end
|
313
|
+
|
314
|
+
message_dialog(@main_window) { |md|
|
315
|
+
title 'High Scores'
|
316
|
+
text high_scores_string
|
317
|
+
|
318
|
+
on(:response) do
|
319
|
+
md.destroy
|
320
|
+
end
|
321
|
+
}.show
|
322
|
+
|
323
|
+
@game.paused = game_paused
|
324
|
+
end
|
325
|
+
|
326
|
+
def show_about_dialog
|
327
|
+
message_dialog(@main_window) { |md|
|
328
|
+
title 'About'
|
329
|
+
text "Glimmer Tetris\n\nGlimmer DSL for GTK\n\nElaborate Sample\n\nCopyright (c) 2021-2022 Andy Maleh"
|
330
|
+
|
331
|
+
on(:response) do
|
332
|
+
md.destroy
|
333
|
+
end
|
334
|
+
}.show
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
Tetris.new.launch
|
@@ -8,61 +8,60 @@ window {
|
|
8
8
|
|
9
9
|
drawing_area {
|
10
10
|
on(:draw) do |drawing_area_widget, cairo_context|
|
11
|
-
cairo_context.
|
12
|
-
cairo_context.
|
13
|
-
cairo_context.fill
|
11
|
+
cairo_context.set_source_rgb(255/255.0, 255/255.0, 255/255.0)
|
12
|
+
cairo_context.paint
|
14
13
|
|
15
14
|
cairo_context.arc(85, 85, 45, (Math::PI/180)*90, -(Math::PI/180)*90)
|
16
15
|
cairo_context.set_source_rgb(255, 0, 0)
|
17
16
|
cairo_context.fill
|
18
17
|
|
19
18
|
cairo_context.arc(85, 85, 45, (Math::PI/180)*90, -(Math::PI/180)*90)
|
20
|
-
cairo_context.set_source_rgb(0, 128, 255)
|
19
|
+
cairo_context.set_source_rgb(0, 128/255.0, 255/255.0)
|
21
20
|
cairo_context.set_line_width(3)
|
22
21
|
cairo_context.stroke
|
23
22
|
|
24
23
|
cairo_context.arc(85, 185, 45, (Math::PI/180)*100, -(Math::PI/180)*30)
|
25
|
-
cairo_context.set_source_rgb(255, 0, 0)
|
24
|
+
cairo_context.set_source_rgb(255/255.0, 0, 0)
|
26
25
|
cairo_context.fill
|
27
26
|
|
28
27
|
cairo_context.arc(85, 185, 45, (Math::PI/180)*100, -(Math::PI/180)*30)
|
29
|
-
cairo_context.set_source_rgb(0, 128, 255)
|
28
|
+
cairo_context.set_source_rgb(0, 128/255.0, 255/255.0)
|
30
29
|
cairo_context.set_line_width(3)
|
31
30
|
cairo_context.stroke
|
32
31
|
|
33
32
|
cairo_context.circle(85, 285, 45)
|
34
|
-
cairo_context.set_source_rgb(255, 0, 0)
|
33
|
+
cairo_context.set_source_rgb(255/255.0, 0, 0)
|
35
34
|
cairo_context.fill
|
36
35
|
|
37
36
|
cairo_context.circle(85, 285, 45)
|
38
|
-
cairo_context.set_source_rgb(0, 128, 255)
|
37
|
+
cairo_context.set_source_rgb(0, 128/255.0, 255/255.0)
|
39
38
|
cairo_context.set_line_width(3)
|
40
39
|
cairo_context.stroke
|
41
40
|
|
42
41
|
cairo_context.rectangle(140, 40, 180, 90)
|
43
|
-
cairo_context.set_source_rgb(255, 255, 0)
|
42
|
+
cairo_context.set_source_rgb(255/255.0, 255/255.0, 0)
|
44
43
|
cairo_context.fill
|
45
44
|
|
46
45
|
cairo_context.rectangle(140, 40, 180, 90)
|
47
|
-
cairo_context.set_source_rgb(255, 0, 0)
|
46
|
+
cairo_context.set_source_rgb(255/255.0, 0, 0)
|
48
47
|
cairo_context.set_line_width(3)
|
49
48
|
cairo_context.stroke
|
50
49
|
|
51
50
|
cairo_context.rounded_rectangle(140, 140, 180, 90, 30, 20)
|
52
|
-
cairo_context.set_source_rgb(255, 255, 0)
|
51
|
+
cairo_context.set_source_rgb(255/255.0, 255/255.0, 0)
|
53
52
|
cairo_context.fill
|
54
53
|
|
55
54
|
cairo_context.rounded_rectangle(140, 140, 180, 90, 30, 20)
|
56
|
-
cairo_context.set_source_rgb(255, 0, 0)
|
55
|
+
cairo_context.set_source_rgb(255/255.0, 0, 0)
|
57
56
|
cairo_context.set_line_width(3)
|
58
57
|
cairo_context.stroke
|
59
58
|
|
60
59
|
cairo_context.triangle(140, 240, 320, 240, 230, 330)
|
61
|
-
cairo_context.set_source_rgb(255, 255, 0)
|
60
|
+
cairo_context.set_source_rgb(255/255.0, 255/255.0, 0)
|
62
61
|
cairo_context.fill
|
63
62
|
|
64
63
|
cairo_context.triangle(140, 240, 320, 240, 230, 330)
|
65
|
-
cairo_context.set_source_rgb(255, 0, 0)
|
64
|
+
cairo_context.set_source_rgb(255/255.0, 0, 0)
|
66
65
|
cairo_context.set_line_width(3)
|
67
66
|
cairo_context.stroke
|
68
67
|
|
@@ -71,7 +70,7 @@ window {
|
|
71
70
|
cairo_context.curve_to 190, 60, 200, 80, 210, 70
|
72
71
|
cairo_context.curve_to 240, 80, 250, 100, 260, 90
|
73
72
|
cairo_context.curve_to 290, 90, 300, 110, 310, 100
|
74
|
-
cairo_context.set_source_rgb(0, 255, 0)
|
73
|
+
cairo_context.set_source_rgb(0, 255/255.0, 0)
|
75
74
|
cairo_context.fill
|
76
75
|
|
77
76
|
cairo_context.new_path
|
@@ -79,7 +78,7 @@ window {
|
|
79
78
|
cairo_context.curve_to 190, 60, 200, 80, 210, 70
|
80
79
|
cairo_context.curve_to 240, 80, 250, 100, 260, 90
|
81
80
|
cairo_context.curve_to 290, 90, 300, 110, 310, 100
|
82
|
-
cairo_context.set_source_rgb(0, 0, 255)
|
81
|
+
cairo_context.set_source_rgb(0, 0, 255/255.0)
|
83
82
|
cairo_context.stroke
|
84
83
|
|
85
84
|
cairo_context.new_path
|
@@ -90,7 +89,7 @@ window {
|
|
90
89
|
cairo_context.line_to 200, 200
|
91
90
|
cairo_context.line_to 180, 170
|
92
91
|
cairo_context.close_path
|
93
|
-
cairo_context.set_source_rgb(0, 255, 0)
|
92
|
+
cairo_context.set_source_rgb(0, 255/255.0, 0)
|
94
93
|
cairo_context.fill
|
95
94
|
|
96
95
|
cairo_context.new_path
|
@@ -101,7 +100,7 @@ window {
|
|
101
100
|
cairo_context.line_to 200, 200
|
102
101
|
cairo_context.line_to 180, 170
|
103
102
|
cairo_context.close_path
|
104
|
-
cairo_context.set_source_rgb(0, 0, 255)
|
103
|
+
cairo_context.set_source_rgb(0, 0, 255/255.0)
|
105
104
|
cairo_context.stroke
|
106
105
|
|
107
106
|
cairo_context.new_path
|
@@ -112,7 +111,7 @@ window {
|
|
112
111
|
cairo_context.line_to 200, 280
|
113
112
|
cairo_context.line_to 180, 270
|
114
113
|
cairo_context.close_path
|
115
|
-
cairo_context.set_source_rgb(0, 255, 0)
|
114
|
+
cairo_context.set_source_rgb(0, 255/255.0, 0)
|
116
115
|
cairo_context.fill
|
117
116
|
|
118
117
|
cairo_context.new_path
|
@@ -123,7 +122,7 @@ window {
|
|
123
122
|
cairo_context.line_to 200, 280
|
124
123
|
cairo_context.line_to 180, 270
|
125
124
|
cairo_context.close_path
|
126
|
-
cairo_context.set_source_rgb(0, 0, 255)
|
125
|
+
cairo_context.set_source_rgb(0, 0, 255/255.0)
|
127
126
|
cairo_context.stroke
|
128
127
|
|
129
128
|
cairo_context.new_path
|
@@ -133,7 +132,7 @@ window {
|
|
133
132
|
cairo_context.line_to 220, 340
|
134
133
|
cairo_context.line_to 200, 330
|
135
134
|
cairo_context.line_to 180, 320
|
136
|
-
cairo_context.set_source_rgb(0, 0, 255)
|
135
|
+
cairo_context.set_source_rgb(0, 0, 255/255.0)
|
137
136
|
cairo_context.stroke
|
138
137
|
end
|
139
138
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-gtk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
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-01-
|
11
|
+
date: 2022-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -16,14 +16,14 @@ 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
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: os
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,8 +159,10 @@ files:
|
|
159
159
|
- bin/girb
|
160
160
|
- bin/girb_runner.rb
|
161
161
|
- glimmer-dsl-gtk.gemspec
|
162
|
+
- images/breaking-blue-wave.png
|
162
163
|
- lib/glimmer-dsl-gtk.rb
|
163
164
|
- lib/glimmer/dsl/gtk/dsl.rb
|
165
|
+
- lib/glimmer/dsl/gtk/observe_expression.rb
|
164
166
|
- lib/glimmer/dsl/gtk/on_expression.rb
|
165
167
|
- lib/glimmer/dsl/gtk/operation_expression.rb
|
166
168
|
- lib/glimmer/dsl/gtk/property_expression.rb
|
@@ -169,19 +171,42 @@ files:
|
|
169
171
|
- lib/glimmer/gtk.rb
|
170
172
|
- lib/glimmer/gtk/shape.rb
|
171
173
|
- lib/glimmer/gtk/shape/arc.rb
|
174
|
+
- lib/glimmer/gtk/shape/arc_negative.rb
|
172
175
|
- lib/glimmer/gtk/shape/circle.rb
|
173
176
|
- lib/glimmer/gtk/shape/path.rb
|
174
177
|
- lib/glimmer/gtk/shape/polygon.rb
|
175
178
|
- lib/glimmer/gtk/shape/polyline.rb
|
176
179
|
- lib/glimmer/gtk/shape/rectangle.rb
|
177
180
|
- lib/glimmer/gtk/shape/rounded_rectangle.rb
|
181
|
+
- lib/glimmer/gtk/shape/square.rb
|
178
182
|
- lib/glimmer/gtk/shape/triangle.rb
|
183
|
+
- lib/glimmer/gtk/transformable.rb
|
179
184
|
- lib/glimmer/gtk/widget_proxy.rb
|
180
185
|
- lib/glimmer/gtk/widget_proxy/application_proxy.rb
|
181
186
|
- lib/glimmer/gtk/widget_proxy/box_proxy.rb
|
182
187
|
- lib/glimmer/gtk/widget_proxy/drawing_area_proxy.rb
|
183
188
|
- lib/glimmer/gtk/widget_proxy/message_dialog_proxy.rb
|
184
189
|
- lib/glimmer/gtk/widget_proxy/window_proxy.rb
|
190
|
+
- samples/cairo/arc.rb
|
191
|
+
- samples/cairo/arc_negative.rb
|
192
|
+
- samples/cairo/clip.rb
|
193
|
+
- samples/cairo/clip_image.rb
|
194
|
+
- samples/cairo/curve_to.rb
|
195
|
+
- samples/cairo/dashes.rb
|
196
|
+
- samples/cairo/fill_and_stroke2.rb
|
197
|
+
- samples/cairo/fill_style.rb
|
198
|
+
- samples/cairo/gradient.rb
|
199
|
+
- samples/cairo/image.rb
|
200
|
+
- samples/cairo/image_gradient.rb
|
201
|
+
- samples/cairo/multi_segment_caps.rb
|
202
|
+
- samples/cairo/rounded_rectangle.rb
|
203
|
+
- samples/cairo/set_line_cap.rb
|
204
|
+
- samples/cairo/set_line_join.rb
|
205
|
+
- samples/elaborate/tetris.rb
|
206
|
+
- samples/elaborate/tetris/model/block.rb
|
207
|
+
- samples/elaborate/tetris/model/game.rb
|
208
|
+
- samples/elaborate/tetris/model/past_game.rb
|
209
|
+
- samples/elaborate/tetris/model/tetromino.rb
|
185
210
|
- samples/elaborate/widget_gallery.rb
|
186
211
|
- samples/hello/hello_application.rb
|
187
212
|
- samples/hello/hello_button.rb
|