forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 547
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from derskythe/feat/existing-file-two-bytes
Feat/existing file two bytes
- Loading branch information
Showing
20 changed files
with
587 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include "gui_top_buttons.h" | ||
|
||
void elements_button_top_left(Canvas* canvas, const char* str) { | ||
const Icon* icon = &I_ButtonUp_7x4; | ||
|
||
const uint8_t button_height = 12; | ||
const uint8_t vertical_offset = 3; | ||
const uint8_t horizontal_offset = 3; | ||
const uint8_t string_width = canvas_string_width(canvas, str); | ||
const uint8_t icon_h_offset = 3; | ||
const uint8_t icon_width_with_offset = icon_get_width(icon) + icon_h_offset; | ||
const uint8_t icon_v_offset = icon_get_height(icon) + vertical_offset; | ||
const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; | ||
|
||
const uint8_t x = 0; | ||
const uint8_t y = 0 + button_height; | ||
|
||
uint8_t line_x = x + button_width; | ||
uint8_t line_y = y - button_height; | ||
canvas_draw_box(canvas, x, line_y, button_width, button_height); | ||
canvas_draw_line(canvas, line_x + 0, line_y, line_x + 0, y - 1); | ||
canvas_draw_line(canvas, line_x + 1, line_y, line_x + 1, y - 2); | ||
canvas_draw_line(canvas, line_x + 2, line_y, line_x + 2, y - 3); | ||
|
||
canvas_invert_color(canvas); | ||
canvas_draw_icon(canvas, x + horizontal_offset, y - icon_v_offset, icon); | ||
canvas_draw_str( | ||
canvas, x + horizontal_offset + icon_width_with_offset, y - vertical_offset, str); | ||
canvas_invert_color(canvas); | ||
} | ||
|
||
void elements_button_top_right(Canvas* canvas, const char* str) { | ||
const Icon* icon = &I_ButtonDown_7x4; | ||
|
||
const uint8_t button_height = 12; | ||
const uint8_t vertical_offset = 3; | ||
const uint8_t horizontal_offset = 3; | ||
const uint8_t string_width = canvas_string_width(canvas, str); | ||
const uint8_t icon_h_offset = 3; | ||
const uint8_t icon_width_with_offset = icon_get_width(icon) + icon_h_offset; | ||
const uint8_t icon_v_offset = icon_get_height(icon) + vertical_offset + 1; | ||
const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; | ||
|
||
const uint8_t x = canvas_width(canvas); | ||
const uint8_t y = 0 + button_height; | ||
|
||
uint8_t line_x = x - button_width; | ||
uint8_t line_y = y - button_height; | ||
canvas_draw_box(canvas, line_x, line_y, button_width, button_height); | ||
canvas_draw_line(canvas, line_x - 1, line_y, line_x - 1, y - 1); | ||
canvas_draw_line(canvas, line_x - 2, line_y, line_x - 2, y - 2); | ||
canvas_draw_line(canvas, line_x - 3, line_y, line_x - 3, y - 3); | ||
|
||
canvas_invert_color(canvas); | ||
canvas_draw_str(canvas, x - button_width + horizontal_offset, y - vertical_offset, str); | ||
canvas_draw_icon( | ||
canvas, x - horizontal_offset - icon_get_width(icon), y - icon_v_offset, icon); | ||
canvas_invert_color(canvas); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include <input/input.h> | ||
#include <gui/elements.h> | ||
#include <gui/icon.h> | ||
#include <gui/icon_animation.h> | ||
#include <assets_icons.h> | ||
|
||
/** | ||
* Thanks to the author of metronome | ||
* @param canvas | ||
* @param str | ||
*/ | ||
void elements_button_top_left(Canvas* canvas, const char* str); | ||
|
||
/** | ||
* Thanks to the author of metronome | ||
* @param canvas | ||
* @param str | ||
*/ | ||
void elements_button_top_right(Canvas* canvas, const char* str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.