vibrate on hitting mine, fix empty cell graphic

flagsbased-uncover
Felix Pankratz 2 years ago
parent 1171f95a37
commit 69d2ef1620

@ -5,7 +5,7 @@ App(
entry_point="minesweeper_app", entry_point="minesweeper_app",
cdefines=["APP_MINESWEEPER"], cdefines=["APP_MINESWEEPER"],
requires=["gui"], requires=["gui"],
stack_size=2 * 1024, stack_size=8 * 1024,
fap_category="Games", fap_category="Games",
order=35, order=35,
) )

@ -1,7 +1,7 @@
#define tile_0_width 8 #define tile_0_width 8
#define tile_0_height 8 #define tile_0_height 8
static uint8_t tile_0_bits[] = { 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_width 8
#define tile_1_height 8 #define tile_1_height 8
static uint8_t tile_1_bits[] = { static uint8_t tile_1_bits[] = {

@ -4,6 +4,8 @@
#include <input/input.h> #include <input/input.h>
#include <stdlib.h> #include <stdlib.h>
#include <notification/notification_messages.h>
#include "assets.h" #include "assets.h"
#define PLAYFIELD_WIDTH 16 #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) { static void play_move(Minesweeper* minesweeper_state, int cursor_x, int cursor_y) {
if (minesweeper_state->playfield[cursor_x][cursor_y] != TileTypeUncleared) { 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) { if (minesweeper_state->minefield[cursor_x][cursor_y] == FieldMine) {
// TODO: player loses! // TODO: player loses!
minesweeper_state->playfield[cursor_x][cursor_y] = TileTypeMine;
game_lost();
return; return;
} else { } else {
// get number of surrounding mines. // get number of surrounding mines.

Loading…
Cancel
Save