Skip to content

Commit

Permalink
Move analog watch face background into resources
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwilsdon committed Aug 1, 2023
1 parent 39d5b5c commit 42f42d1
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 277 deletions.
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ list(APPEND SOURCE_FILES
displayapp/screens/settings/SettingBluetooth.cpp

## Watch faces
displayapp/icons/bg_clock.c
displayapp/screens/WatchFaceAnalog.cpp
displayapp/screens/WatchFaceDigital.cpp
displayapp/screens/WatchFaceInfineat.cpp
Expand Down
272 changes: 0 additions & 272 deletions src/displayapp/icons/bg_clock.c

This file was deleted.

15 changes: 12 additions & 3 deletions src/displayapp/screens/WatchFaceAnalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include "components/settings/Settings.h"
#include "displayapp/InfiniTimeTheme.h"

LV_IMG_DECLARE(bg_clock);

using namespace Pinetime::Applications::Screens;

namespace {
Expand Down Expand Up @@ -61,7 +59,7 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
sSecond = 99;

lv_obj_t* bg_clock_img = lv_img_create(lv_scr_act(), nullptr);
lv_img_set_src(bg_clock_img, &bg_clock);
lv_img_set_src(bg_clock_img, "F:/images/bg_clock.bin");
lv_obj_align(bg_clock_img, nullptr, LV_ALIGN_CENTER, 0, 0);

batteryIcon.Create(lv_scr_act());
Expand Down Expand Up @@ -232,3 +230,14 @@ void WatchFaceAnalog::Refresh() {
}
}
}

bool WatchFaceAnalog::IsAvailable(Pinetime::Controllers::FS& filesystem) {
lfs_file file = {};

if (filesystem.FileOpen(&file, "/images/bg_clock.bin", LFS_O_RDONLY) < 0) {
return false;
}

filesystem.FileClose(&file);
return true;
}
2 changes: 2 additions & 0 deletions src/displayapp/screens/WatchFaceAnalog.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ namespace Pinetime {

void Refresh() override;

static bool IsAvailable(Pinetime::Controllers::FS& filesystem);

private:
uint8_t sHour, sMinute, sSecond;

Expand Down
3 changes: 2 additions & 1 deletion src/displayapp/screens/settings/SettingWatchFace.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "displayapp/screens/CheckboxList.h"
#include "displayapp/screens/WatchFaceInfineat.h"
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
#include "displayapp/screens/WatchFaceAnalog.h"

namespace Pinetime {

Expand Down Expand Up @@ -42,7 +43,7 @@ namespace Pinetime {

std::array<Screens::CheckboxList::Item, settingsPerScreen * nScreens> watchfaces {
{{"Digital face", true},
{"Analog face", true},
{"Analog face", Applications::Screens::WatchFaceAnalog::IsAvailable(filesystem)},
{"PineTimeStyle", true},
{"Terminal", true},
{"Infineat face", Applications::Screens::WatchFaceInfineat::IsAvailable(filesystem)},
Expand Down
7 changes: 7 additions & 0 deletions src/resources/images.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@
"output_format": "bin",
"binary_format": "ARGB8565_RBSWAP",
"target_path": "/images/"
},
"bg_clock": {
"sources": "images/bg_clock.png",
"color_format": "CF_TRUE_COLOR_ALPHA",
"output_format": "bin",
"binary_format": "ARGB8565_RBSWAP",
"target_path": "/images/"
}
}
Binary file added src/resources/images/bg_clock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 42f42d1

Please sign in to comment.