mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-29 06:24:45 -07:00
Update gui.c
This commit is contained in:
@@ -74,52 +74,31 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
|||||||
ViewPort* view_port = *ViewPortArray_ref(it);
|
ViewPort* view_port = *ViewPortArray_ref(it);
|
||||||
if(view_port_is_enabled(view_port)) {
|
if(view_port_is_enabled(view_port)) {
|
||||||
width = view_port_get_width(view_port);
|
width = view_port_get_width(view_port);
|
||||||
if(!width) width = 8;
|
if(!width) width = 1;
|
||||||
// Recalculate next position
|
// Recalculate next position
|
||||||
right_used += (width + 2);
|
right_used += (width + 2);
|
||||||
x -= (width + 2);
|
x -= (width + 2);
|
||||||
// Prepare work area background
|
// Prepare work area background (This part prints the background image)
|
||||||
canvas_frame_set(
|
canvas_frame_set(
|
||||||
gui->canvas,
|
gui->canvas,
|
||||||
x - 1,
|
x - 1,
|
||||||
GUI_STATUS_BAR_Y + 1,
|
GUI_STATUS_BAR_Y + 64,
|
||||||
width + 2,
|
width + 2,
|
||||||
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
||||||
canvas_set_color(gui->canvas, ColorWhite);
|
canvas_set_color(gui->canvas, ColorWhite);
|
||||||
canvas_draw_box(
|
canvas_draw_box(
|
||||||
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
||||||
canvas_set_color(gui->canvas, ColorBlack);
|
canvas_set_color(gui->canvas, ColorWhite);
|
||||||
// ViewPort draw
|
// ViewPort draw
|
||||||
canvas_frame_set(
|
canvas_frame_set(
|
||||||
gui->canvas, x, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
// SASQUACH SAYS this is wwhere you can move the battery bar, 64 moves it off screen
|
||||||
|
gui->canvas, x + 5, GUI_STATUS_BAR_Y + 0, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
||||||
view_port_draw(view_port, gui->canvas);
|
view_port_draw(view_port, gui->canvas);
|
||||||
}
|
}
|
||||||
ViewPortArray_next(it);
|
ViewPortArray_next(it);
|
||||||
}
|
}
|
||||||
// Draw frame around icons on the right
|
// Draw frame around icons on the right
|
||||||
if(right_used) {
|
|
||||||
canvas_frame_set(
|
|
||||||
gui->canvas,
|
|
||||||
GUI_DISPLAY_WIDTH - 3 - right_used,
|
|
||||||
GUI_STATUS_BAR_Y,
|
|
||||||
right_used + 3,
|
|
||||||
GUI_STATUS_BAR_HEIGHT);
|
|
||||||
canvas_set_color(gui->canvas, ColorBlack);
|
|
||||||
canvas_draw_rframe(
|
|
||||||
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
|
|
||||||
canvas_draw_line(
|
|
||||||
gui->canvas,
|
|
||||||
canvas_width(gui->canvas) - 2,
|
|
||||||
1,
|
|
||||||
canvas_width(gui->canvas) - 2,
|
|
||||||
canvas_height(gui->canvas) - 2);
|
|
||||||
canvas_draw_line(
|
|
||||||
gui->canvas,
|
|
||||||
1,
|
|
||||||
canvas_height(gui->canvas) - 2,
|
|
||||||
canvas_width(gui->canvas) - 2,
|
|
||||||
canvas_height(gui->canvas) - 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Left side
|
// Left side
|
||||||
x = 2;
|
x = 2;
|
||||||
@@ -133,7 +112,8 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
|||||||
canvas_frame_set(
|
canvas_frame_set(
|
||||||
gui->canvas,
|
gui->canvas,
|
||||||
x - 1,
|
x - 1,
|
||||||
GUI_STATUS_BAR_Y + 1,
|
// SASQUACH SAYS : This is the white box behind the left bar, move it 64 to hide it
|
||||||
|
GUI_STATUS_BAR_Y + 64,
|
||||||
width + 2,
|
width + 2,
|
||||||
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
||||||
canvas_set_color(gui->canvas, ColorWhite);
|
canvas_set_color(gui->canvas, ColorWhite);
|
||||||
@@ -142,7 +122,8 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
|||||||
canvas_set_color(gui->canvas, ColorBlack);
|
canvas_set_color(gui->canvas, ColorBlack);
|
||||||
// ViewPort draw
|
// ViewPort draw
|
||||||
canvas_frame_set(
|
canvas_frame_set(
|
||||||
gui->canvas, x, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
// SASQUACH SAYS : This is where you move the Icons for the left bar, 64 to hide it
|
||||||
|
gui->canvas, x, GUI_STATUS_BAR_Y + 64, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
||||||
view_port_draw(view_port, gui->canvas);
|
view_port_draw(view_port, gui->canvas);
|
||||||
// Recalculate next position
|
// Recalculate next position
|
||||||
left_used += (width + 2);
|
left_used += (width + 2);
|
||||||
@@ -172,23 +153,6 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
|||||||
x += (width + 2);
|
x += (width + 2);
|
||||||
}
|
}
|
||||||
// Draw frame around icons on the left
|
// Draw frame around icons on the left
|
||||||
if(left_used) {
|
|
||||||
canvas_frame_set(gui->canvas, 0, 0, left_used + 3, GUI_STATUS_BAR_HEIGHT);
|
|
||||||
canvas_draw_rframe(
|
|
||||||
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
|
|
||||||
canvas_draw_line(
|
|
||||||
gui->canvas,
|
|
||||||
canvas_width(gui->canvas) - 2,
|
|
||||||
1,
|
|
||||||
canvas_width(gui->canvas) - 2,
|
|
||||||
canvas_height(gui->canvas) - 2);
|
|
||||||
canvas_draw_line(
|
|
||||||
gui->canvas,
|
|
||||||
1,
|
|
||||||
canvas_height(gui->canvas) - 2,
|
|
||||||
canvas_width(gui->canvas) - 2,
|
|
||||||
canvas_height(gui->canvas) - 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gui_redraw_window(Gui* gui) {
|
bool gui_redraw_window(Gui* gui) {
|
||||||
|
|||||||
Reference in New Issue
Block a user