mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 11:38:36 -07:00
more upds
This commit is contained in:
@@ -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=4 * 1024,
|
stack_size=8 * 1024,
|
||||||
fap_category="Games",
|
fap_category="Games",
|
||||||
fap_icon="minesweeper_icon.png",
|
fap_icon="minesweeper_icon.png",
|
||||||
order=35,
|
order=35,
|
||||||
|
|||||||
@@ -79,23 +79,25 @@ static void render_callback(Canvas* const canvas, void* ctx) {
|
|||||||
if (minesweeper_state == NULL) {
|
if (minesweeper_state == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FuriString* tempStr;
|
FuriString* mineStr;
|
||||||
tempStr = furi_string_alloc();
|
FuriString* timeStr;
|
||||||
furi_string_cat_printf(tempStr, "Mines: %d", MINECOUNT - minesweeper_state->flags_set);
|
mineStr = furi_string_alloc();
|
||||||
|
timeStr = furi_string_alloc();
|
||||||
|
|
||||||
|
furi_string_printf(mineStr, "Mines: %d", MINECOUNT - minesweeper_state->flags_set);
|
||||||
canvas_set_font(canvas, FontSecondary);
|
canvas_set_font(canvas, FontSecondary);
|
||||||
canvas_draw_str_aligned(canvas, 0, 0, AlignLeft, AlignTop, furi_string_get_cstr(tempStr));
|
canvas_draw_str_aligned(canvas, 0, 0, AlignLeft, AlignTop, furi_string_get_cstr(mineStr));
|
||||||
furi_string_free(tempStr);
|
|
||||||
int seconds = 0;
|
int seconds = 0;
|
||||||
int minutes = 0;
|
int minutes = 0;
|
||||||
if (minesweeper_state->game_started) {
|
if (minesweeper_state->game_started) {
|
||||||
uint32_t ticks_elapsed = furi_get_tick() - minesweeper_state->game_started_tick;
|
uint32_t ticks_elapsed = furi_get_tick() - minesweeper_state->game_started_tick;
|
||||||
seconds = (int) ticks_elapsed / furi_kernel_get_tick_frequency();
|
seconds = (int) ticks_elapsed / furi_kernel_get_tick_frequency();
|
||||||
minutes = (int) seconds / 60;
|
minutes = (int) seconds / 60;
|
||||||
seconds = seconds % 60;
|
seconds = seconds % 60;
|
||||||
}
|
}
|
||||||
furi_string_cat_printf(tempStr, "%01d:%02d", minutes, seconds);
|
furi_string_printf(timeStr, "%01d:%02d", minutes, seconds);
|
||||||
canvas_draw_str_aligned(canvas, 128, 0, AlignRight, AlignTop, furi_string_get_cstr(tempStr));
|
canvas_draw_str_aligned(canvas, 128, 0, AlignRight, AlignTop, furi_string_get_cstr(timeStr));
|
||||||
furi_string_free(tempStr);
|
|
||||||
|
|
||||||
for (int y = 0; y < PLAYFIELD_HEIGHT; y++) {
|
for (int y = 0; y < PLAYFIELD_HEIGHT; y++) {
|
||||||
for (int x = 0; x < PLAYFIELD_WIDTH; x++) {
|
for (int x = 0; x < PLAYFIELD_WIDTH; x++) {
|
||||||
@@ -217,7 +219,9 @@ static void render_callback(Canvas* const canvas, void* ctx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
furi_string_free(tempStr);
|
|
||||||
|
furi_string_free(mineStr);
|
||||||
|
furi_string_free(timeStr);
|
||||||
release_mutex((ValueMutex*)ctx, minesweeper_state);
|
release_mutex((ValueMutex*)ctx, minesweeper_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,4 +517,3 @@ int32_t minesweeper_app(void* p) {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,6 @@ App(
|
|||||||
],
|
],
|
||||||
provides=["desktop_settings"],
|
provides=["desktop_settings"],
|
||||||
conflicts=["updater"],
|
conflicts=["updater"],
|
||||||
stack_size=4 * 1024,
|
stack_size=8 * 1024,
|
||||||
order=60,
|
order=60,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user