diff --git a/application.fam b/application.fam index 1897482..c375cbb 100644 --- a/application.fam +++ b/application.fam @@ -5,7 +5,7 @@ App( entry_point="minesweeper_app", cdefines=["APP_MINESWEEPER"], requires=["gui"], - stack_size=2 * 1024, + stack_size=8 * 1024, fap_category="Games", order=35, ) diff --git a/assets.h b/assets.h index 80a6c89..403c8de 100644 --- a/assets.h +++ b/assets.h @@ -1,7 +1,7 @@ #define tile_0_width 8 #define tile_0_height 8 static uint8_t tile_0_bits[] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; #define tile_1_width 8 #define tile_1_height 8 static uint8_t tile_1_bits[] = { diff --git a/minesweeper.c b/minesweeper.c index 43c420b..ffd2418 100644 --- a/minesweeper.c +++ b/minesweeper.c @@ -4,6 +4,8 @@ #include #include +#include + #include "assets.h" #define PLAYFIELD_WIDTH 16 @@ -209,6 +211,13 @@ static void place_flag(Minesweeper* minesweeper_state) { } } +static void game_lost() { + NotificationApp* notifications = furi_record_open(RECORD_NOTIFICATION); + notification_message(notifications, &sequence_set_vibro_on); + furi_delay_ms(200); + notification_message(notifications, &sequence_reset_vibro); + furi_record_close(RECORD_NOTIFICATION); +} static void play_move(Minesweeper* minesweeper_state, int cursor_x, int cursor_y) { if (minesweeper_state->playfield[cursor_x][cursor_y] != TileTypeUncleared) { @@ -217,6 +226,8 @@ static void play_move(Minesweeper* minesweeper_state, int cursor_x, int cursor_y } if (minesweeper_state->minefield[cursor_x][cursor_y] == FieldMine) { // TODO: player loses! + minesweeper_state->playfield[cursor_x][cursor_y] = TileTypeMine; + game_lost(); return; } else { // get number of surrounding mines.