mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-08 05:39:09 -07:00
Merge branch '420' of https://github.com/RogueMaster/flipperzero-firmware-wPlugins into dev
This commit is contained in:
@@ -17,6 +17,7 @@ extern "C" {
|
||||
typedef enum {
|
||||
ColorWhite = 0x00,
|
||||
ColorBlack = 0x01,
|
||||
ColorXOR = 0x02,
|
||||
} Color;
|
||||
|
||||
/** Fonts enumeration */
|
||||
|
||||
@@ -41,6 +41,31 @@ void elements_progress_bar(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width,
|
||||
canvas_draw_box(canvas, x + 1, y + 1, progress_length, height - 2);
|
||||
}
|
||||
|
||||
void elements_progress_bar_with_text(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
uint8_t y,
|
||||
uint8_t width,
|
||||
float progress,
|
||||
const char* text) {
|
||||
furi_assert(canvas);
|
||||
furi_assert((progress >= 0.0f) && (progress <= 1.0f));
|
||||
uint8_t height = 11;
|
||||
|
||||
uint8_t progress_length = roundf(progress * (width - 2));
|
||||
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
canvas_draw_box(canvas, x + 1, y + 1, width - 2, height - 2);
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
canvas_draw_rframe(canvas, x, y, width, height, 3);
|
||||
|
||||
canvas_draw_box(canvas, x + 1, y + 1, progress_length, height - 2);
|
||||
|
||||
canvas_set_color(canvas, ColorXOR);
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str_aligned(canvas, x + width / 2, y + 2, AlignCenter, AlignTop, text);
|
||||
}
|
||||
|
||||
void elements_scrollbar_pos(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
|
||||
@@ -31,6 +31,23 @@ extern "C" {
|
||||
*/
|
||||
void elements_progress_bar(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, float progress);
|
||||
|
||||
/** Draw progress bar with text.
|
||||
*
|
||||
* @param canvas Canvas instance
|
||||
* @param x progress bar position on X axis
|
||||
* @param y progress bar position on Y axis
|
||||
* @param width progress bar width
|
||||
* @param progress progress (0.0 - 1.0)
|
||||
* @param text text to draw
|
||||
*/
|
||||
void elements_progress_bar_with_text(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
uint8_t y,
|
||||
uint8_t width,
|
||||
float progress,
|
||||
const char* text);
|
||||
|
||||
/** Draw scrollbar on canvas at specific position.
|
||||
*
|
||||
* @param canvas Canvas instance
|
||||
|
||||
Reference in New Issue
Block a user