[FL-1019] New main screen and graphics (#389)

* new status bar, lock menu and dolphin activities screen

* lock icon indication 

* main screen animation, basic scene switching

* level progression calculations based on icounter value 

Co-authored-by: rusdacent <rusdacentx0x08@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
its your bedtime
2021-03-25 20:48:58 +03:00
committed by GitHub
parent 610f4f5d73
commit 372710c31a
42 changed files with 454 additions and 34 deletions

View File

@@ -46,8 +46,12 @@ void gui_redraw_status_bar(Gui* gui) {
uint8_t x_used = 0;
uint8_t width;
ViewPort* view_port;
canvas_frame_set(
gui->canvas, GUI_STATUS_BAR_X, GUI_STATUS_BAR_Y, GUI_DISPLAY_WIDTH, GUI_STATUS_BAR_HEIGHT);
canvas_draw_icon_name(gui->canvas, 0, 0, I_Background_128x11);
// Right side
x = GUI_DISPLAY_WIDTH + 2;
x = GUI_DISPLAY_WIDTH;
ViewPortArray_it(it, gui->layers[GuiLayerStatusBarRight]);
while(!ViewPortArray_end_p(it) && x_used < GUI_STATUS_BAR_WIDTH) {
// Render view_port;
@@ -57,7 +61,28 @@ void gui_redraw_status_bar(Gui* gui) {
if(!width) width = 8;
x_used += width;
x -= (width + 2);
canvas_frame_set(gui->canvas, x, GUI_STATUS_BAR_Y, width, GUI_STATUS_BAR_HEIGHT);
canvas_frame_set(gui->canvas, x - 3, GUI_STATUS_BAR_Y, width, GUI_STATUS_BAR_HEIGHT);
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_box(gui->canvas, 1, 1, width + 3, 11);
canvas_set_color(gui->canvas, ColorBlack);
canvas_draw_box(gui->canvas, 1, 0, 1, 12);
canvas_draw_box(gui->canvas, 0, 1, 1, 11);
canvas_draw_box(gui->canvas, 1, 11, width + 4, 2);
canvas_draw_box(gui->canvas, 1, 0, width + 4, 1);
canvas_draw_box(gui->canvas, width + 4, 1, 1, 11);
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_dot(gui->canvas, width + 4, 0);
canvas_draw_dot(gui->canvas, width + 4, 12);
canvas_set_color(gui->canvas, ColorBlack);
canvas_frame_set(gui->canvas, x, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_HEIGHT);
view_port_draw(view_port, gui->canvas);
}
ViewPortArray_next(it);
@@ -73,7 +98,31 @@ void gui_redraw_status_bar(Gui* gui) {
if(!width) width = 8;
x_used += width;
canvas_frame_set(gui->canvas, x, GUI_STATUS_BAR_Y, width, GUI_STATUS_BAR_HEIGHT);
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_box(gui->canvas, 1, 1, width + 3, 11);
canvas_set_color(gui->canvas, ColorBlack);
if(x == 0) { // Frame start
canvas_draw_box(gui->canvas, 1, 0, 1, 12);
canvas_draw_box(gui->canvas, 0, 1, 1, 11);
}
canvas_draw_box(gui->canvas, 1, 11, width + 4, 2);
canvas_draw_box(gui->canvas, 1, 0, width + 4, 1);
canvas_draw_box(gui->canvas, width + 4, 0, 1, 12);
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_dot(gui->canvas, width + 4, 0);
canvas_draw_dot(gui->canvas, width + 4, 12);
canvas_set_color(gui->canvas, ColorBlack);
canvas_frame_set(
gui->canvas, x + 3, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_HEIGHT);
view_port_draw(view_port, gui->canvas);
x += (width + 2);
}
ViewPortArray_next(it);

View File

@@ -58,3 +58,13 @@ void icon_stop_animation(Icon* icon) {
icon->tick = 0;
icon->frame = 0;
}
uint8_t icon_get_current_frame(Icon* icon) {
furi_assert(icon);
return icon->frame;
}
bool icon_is_last_frame(Icon* icon) {
furi_assert(icon);
return icon->data->frame_count - icon->frame <= 1;
}

View File

@@ -46,6 +46,16 @@ void icon_start_animation(Icon* icon);
*/
void icon_stop_animation(Icon* icon);
/*
* Get current frame
*/
uint8_t icon_get_current_frame(Icon* icon);
/*
* Returns true if current frame is a last one
*/
bool icon_is_last_frame(Icon* icon);
#ifdef __cplusplus
}
#endif