@@ -79,12 +79,15 @@ static void render_callback(Canvas* const canvas, void* ctx) {
79
79
if (minesweeper_state == NULL ) {
80
80
return ;
81
81
}
82
- FuriString * tempStr ;
83
- tempStr = furi_string_alloc ();
84
- furi_string_printf (tempStr , "Mines: %d" , MINECOUNT - minesweeper_state -> flags_set );
82
+ FuriString * mineStr ;
83
+ FuriString * timeStr ;
84
+ mineStr = furi_string_alloc ();
85
+ timeStr = furi_string_alloc ();
86
+
87
+ furi_string_printf (mineStr , "Mines: %d" , MINECOUNT - minesweeper_state -> flags_set );
85
88
canvas_set_font (canvas , FontSecondary );
86
- canvas_draw_str_aligned (canvas , 0 , 0 , AlignLeft , AlignTop , furi_string_get_cstr (tempStr ));
87
- furi_string_free ( tempStr );
89
+ canvas_draw_str_aligned (canvas , 0 , 0 , AlignLeft , AlignTop , furi_string_get_cstr (mineStr ));
90
+
88
91
int seconds = 0 ;
89
92
int minutes = 0 ;
90
93
if (minesweeper_state -> game_started ) {
@@ -93,9 +96,8 @@ static void render_callback(Canvas* const canvas, void* ctx) {
93
96
minutes = (int ) seconds / 60 ;
94
97
seconds = seconds % 60 ;
95
98
}
96
- furi_string_printf (tempStr , "%01d:%02d" , minutes , seconds );
97
- canvas_draw_str_aligned (canvas , 128 , 0 , AlignRight , AlignTop , furi_string_get_cstr (tempStr ));
98
- furi_string_free (tempStr );
99
+ furi_string_printf (timeStr , "%01d:%02d" , minutes , seconds );
100
+ canvas_draw_str_aligned (canvas , 128 , 0 , AlignRight , AlignTop , furi_string_get_cstr (timeStr ));
99
101
100
102
for (int y = 0 ; y < PLAYFIELD_HEIGHT ; y ++ ) {
101
103
for (int x = 0 ; x < PLAYFIELD_WIDTH ; x ++ ) {
@@ -217,7 +219,9 @@ static void render_callback(Canvas* const canvas, void* ctx) {
217
219
}
218
220
}
219
221
}
220
- furi_string_free (tempStr );
222
+
223
+ furi_string_free (mineStr );
224
+ furi_string_free (timeStr );
221
225
release_mutex ((ValueMutex * )ctx , minesweeper_state );
222
226
}
223
227
0 commit comments