center button prompt

master
Felix Pankratz 2 years ago
parent 06a16410e9
commit 7540797c2e

@ -33,7 +33,7 @@ static void render_callback(Canvas* const canvas, void* ctx) {
if(metronome_state == NULL) { if(metronome_state == NULL) {
return; return;
} }
char* play_state; // char* play_state;
string_t tempStr; string_t tempStr;
string_init(tempStr); string_init(tempStr);
@ -41,13 +41,13 @@ static void render_callback(Canvas* const canvas, void* ctx) {
canvas_draw_frame(canvas, 0, 0, 128, 64); canvas_draw_frame(canvas, 0, 0, 128, 64);
canvas_set_font(canvas, FontPrimary); canvas_set_font(canvas, FontPrimary);
// draw playing state // // draw playing state
if (metronome_state->playing) { // if (metronome_state->playing) {
play_state = "Playing"; // play_state = "Playing";
} else { // } else {
play_state = "Paused"; // play_state = "Paused";
} // }
canvas_draw_str_aligned(canvas, 5, 10, AlignLeft, AlignBottom, play_state); // canvas_draw_str_aligned(canvas, 5, 10, AlignLeft, AlignBottom, play_state);
// draw BPM value // draw BPM value
string_printf(tempStr, "%.2f", metronome_state->bpm); string_printf(tempStr, "%.2f", metronome_state->bpm);
@ -57,8 +57,13 @@ static void render_callback(Canvas* const canvas, void* ctx) {
// draw button prompts // draw button prompts
canvas_set_font(canvas, FontSecondary); canvas_set_font(canvas, FontSecondary);
elements_button_left(canvas, "Slower"); elements_button_left(canvas, "Slow");
elements_button_right(canvas, "Faster"); elements_button_right(canvas, "Fast");
if (metronome_state->playing) {
elements_button_center(canvas, "Stop ");
} else {
elements_button_center(canvas, "Start");
}
string_clear(tempStr); string_clear(tempStr);
release_mutex((ValueMutex*)ctx, metronome_state); release_mutex((ValueMutex*)ctx, metronome_state);

Loading…
Cancel
Save