Skip to content

Commit

Permalink
Merge pull request #6 from Kuronons/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
TalkingSasquach authored Jan 2, 2023
2 parents 145b94d + e21a4e6 commit 8a4456e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions applications/settings/dolphin_passport/passport.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ static void render_callback(Canvas* canvas, void* ctx) {
DolphinStats* stats = ctx;

char level_str[20];
char xp_str[12];
char mood_str[32];
uint8_t mood = 0;

if(stats->butthurt <= 4) {
mood = 0;
snprintf(mood_str, 20, "Mood: Squachy!");
snprintf(mood_str, 20, "Mood: Squachy !");
} else if(stats->butthurt <= 9) {
mood = 1;
snprintf(mood_str, 20, "Mood: Meh");
Expand All @@ -53,6 +54,7 @@ static void render_callback(Canvas* canvas, void* ctx) {
}

uint32_t xp_progress = 0;
uint32_t xp_above_last_levelup = dolphin_state_xp_to_levelup(stats->icounter);
uint32_t xp_to_levelup = dolphin_state_xp_to_levelup(stats->icounter);
uint32_t xp_for_current_level =
xp_to_levelup + dolphin_state_xp_above_last_levelup(stats->icounter);
Expand All @@ -67,21 +69,28 @@ static void render_callback(Canvas* canvas, void* ctx) {

// portrait
furi_assert((stats->level > 0) && (stats->level <= 3));
canvas_draw_icon(canvas, 9, 5, portraits[mood][stats->level - 1]);
canvas_draw_line(canvas, 58, 16, 123, 16);
canvas_draw_line(canvas, 58, 30, 123, 30);
canvas_draw_line(canvas, 58, 44, 123, 44);
canvas_draw_icon(canvas, 11, 2, portraits[mood][stats->level - 1]);

const char* my_name = furi_hal_version_get_name_ptr();
// LEVEL DISPLAY
snprintf(level_str, 20, "Level: %hu", stats->level);
canvas_draw_str(canvas, 58, 12, my_name ? my_name : "Unknown");
canvas_draw_str(canvas, 58, 26, mood_str);
canvas_draw_str(canvas, 58, 40, level_str);

// XP / XP DISPLAY
snprintf(xp_str, 12, "%lu/%lu", xp_above_last_levelup, xp_for_current_level);
canvas_set_font(canvas, FontSecondary);
// POSITION OF NAME (58,12 ofw) -> TO CUSTOM NAME : change [my_name ? my_name] to [my_name ? "WHATYOUWANT"]
canvas_draw_str(canvas, 59, 10, my_name ? my_name : "Unknown");
// POSITION OF MOOD (58,26 ofw):
canvas_draw_str(canvas, 59, 22, mood_str);
canvas_set_color(canvas, ColorBlack);
// POSITION OF LEVEL (58,40 ofw):
canvas_draw_str(canvas, 59, 34, level_str);
// POSITION OF XP / XP
canvas_draw_str(canvas, 59, 43, xp_str);
// POSITION AND SIZE OF XP BAR (123... 47... +1, 6 [bar thickness] ofw)

canvas_set_color(canvas, ColorWhite);
canvas_draw_box(canvas, 123 - xp_progress, 47, xp_progress + 1, 6);
canvas_draw_box(canvas, 123 - xp_progress, 45, xp_progress + 1, 5);
canvas_set_color(canvas, ColorBlack);
canvas_draw_line(canvas, 123, 47, 123, 52);
}

int32_t passport_app(void* p) {
Expand Down
Binary file added assets/icons/Passport/passport_Mountains.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/icons/Passport/passport_bottom_128x18.png
Binary file not shown.
Binary file removed assets/icons/Passport/passport_left_6x46.png
Binary file not shown.
Binary file removed assets/icons/Passport/passport_mountains.png
Binary file not shown.

0 comments on commit 8a4456e

Please sign in to comment.