the buttons were mixed up. wonder if there's some more mnemonic thing
to do than using the numbers - constants add visual clutter. perhaps
define methods left, right and middle within the context of a click
block, so we can say
case button
when left; foo
when right; bar
when middle; baz
end
rather than having to yell LEFT, RIGHT and MIDDLE
martin
diff --git a/samples/expert-minesweeper.rb b/samples/expert-minesweeper.rb
index d3ea47c..c290107 100644
--- a/samples/expert-minesweeper.rb
+++ b/samples/expert-minesweeper.rb
@@ -256,9 +256,9 @@ Shoes.app :width => 730, :height => 450, :title => 'Minesweeper' do
click do |button, x, y|
next if @field.game_over? || @field.all_found?
fx, fy = (([EMAIL PROTECTED]) / @field.cell_size).to_i, (([EMAIL PROTECTED]) / @field.cell_size).to_i
- @field.click!(fx, fy) if button == 1
- @field.flag!(fx, fy) if button == 2
- @field.reveal!(fx, fy) if button == 3
+ @field.click!(fx, fy) if button == 1 # left
+ @field.flag!(fx, fy) if button == 3 # right
+ @field.reveal!(fx, fy) if button == 2 # middle
render_field
alert("Winner!\nTotal time: [EMAIL PROTECTED]") if @field.all_found?