From 9a52731601e8bf3dafac3565d44de11c9dba610f Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 6 Dec 2005 03:55:45 +0000 Subject: [PATCH] More sound effects, drop solution dialog (green tiles mean solved...) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4686 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- test/sudoku.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/sudoku.cxx b/test/sudoku.cxx index d4094f7ec..39c77b356 100644 --- a/test/sudoku.cxx +++ b/test/sudoku.cxx @@ -592,14 +592,15 @@ Sudoku::check_game(bool highlight) { if (!empty && correct) { // Success! - for (i = 0; i < 9; i ++) + for (i = 0; i < 9; i ++) { for (j = 0; j < 9; j ++) { SudokuCell *cell = grid_cells_[i][j]; cell->color(FL_GREEN); cell->readonly(1); } - fl_message("Congratulations, you solved the game!"); + sound_->play('A' + grid_cells_[i][8]->value() - 1); + } } } @@ -919,19 +920,17 @@ void Sudoku::solve_game() { int i, j; - for (i = 0; i < 9; i ++) + for (i = 0; i < 9; i ++) { for (j = 0; j < 9; j ++) { SudokuCell *cell = grid_cells_[i][j]; - bool play_note = false; - - if (cell->value() != grid_values_[i][j]) play_note = true; cell->value(grid_values_[i][j]); cell->readonly(1); - cell->color(fl_color_average(FL_GRAY, FL_GREEN, 0.5f)); - - if (play_note) sound_->play('A' + cell->value() - 1); + cell->color(FL_GRAY); } + + sound_->play('A' + grid_cells_[i][8]->value() - 1); + } }