From da3ff8d5e6a15d100f504ec8610835157bd387db Mon Sep 17 00:00:00 2001 From: synzr Date: Sat, 18 Oct 2025 13:01:18 +0500 Subject: [PATCH] feat(layer): bar layer --- package.json | 4 +-- resources/font_koneko_toro.ttf | Bin 4618 -> 4618 bytes src/c/bar_layer.c | 53 +++++++++++++++++++++++++++++++++ src/c/bar_layer.h | 10 +++++++ src/c/main_window.c | 11 ++++--- src/c/resources_service.c | 4 +-- 6 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 src/c/bar_layer.c create mode 100644 src/c/bar_layer.h diff --git a/package.json b/package.json index 9080e69..5573c89 100644 --- a/package.json +++ b/package.json @@ -38,12 +38,12 @@ "spaceOptimization": "memory" }, { "type": "font", - "name": "FONT_TORO_38", + "name": "FONT_TORO_36", "file": "font_toro.ttf", "characterRange": "[0-9:]" }, { "type": "font", - "name": "FONT_KONEKO_TORO_28", + "name": "FONT_KONEKO_TORO_24", "file": "font_koneko_toro.ttf", "characterRange": "[0-9/WTFSMedhuriaton]" }] diff --git a/resources/font_koneko_toro.ttf b/resources/font_koneko_toro.ttf index 0c51d0c1b1597691e63c81275522ba1bb2f81da8..f2528a1b32cda099b345e04ebe9b686c826fd834 100644 GIT binary patch delta 397 zcmeBD=~9^>UO$0>fq}z6Sl=ijC{2%nfzblUPe{&9EMQ||yTQP~!~+!TNYANETXJY> zF#`h&kk6r$k(!ti72OA9GwcCkvkagBTNBefAo~jtt7PPsR9G=E0hx?5fJ8}7esUrM zL*@|%2IeV1enoC#MFE2{gBSyY7o!AFKp`(NH?{cvAyEbf9-sr5%nS01OBga4j2RgC z3PADUa!Hxz`)@jtZx(%l%~hPz-R&FCnV=47O>{B0r^ZEK(UhaoXWJh`V(F< zFfe~$U|@fck(!ti72^B_sCEw!n`Hn6*qWH;0@)xjm5khy3JV4%Ad_(hkSNH>PflcD zNL&KcUjyWq + +void bar_layer_init(Window *window); +void bar_layer_tick(void); +void bar_layer_deinit(void); + +#endif diff --git a/src/c/main_window.c b/src/c/main_window.c index 304cc2c..6a65444 100644 --- a/src/c/main_window.c +++ b/src/c/main_window.c @@ -1,4 +1,6 @@ #include "main_window.h" + +#include "bar_layer.h" #include "character_layer.h" #include "clock_layer.h" @@ -7,26 +9,27 @@ static Window *s_main_window; static void main_window_tick(struct tm *time, TimeUnits units) { character_layer_tick(); clock_layer_tick(); + bar_layer_tick(); } static void main_window_load(Window *window) { character_layer_init(s_main_window); clock_layer_init(s_main_window, GPoint(0, 40)); + bar_layer_init(s_main_window); tick_timer_service_subscribe(SECOND_UNIT, main_window_tick); } static void main_window_unload(Window *window) { tick_timer_service_unsubscribe(); clock_layer_deinit(); + bar_layer_deinit(); character_layer_deinit(); } void main_window_init(void) { s_main_window = window_create(); - window_set_window_handlers(s_main_window, (WindowHandlers) { - .load = main_window_load, - .unload = main_window_unload - }); + window_set_window_handlers( + s_main_window, (WindowHandlers){.load = main_window_load, .unload = main_window_unload}); window_stack_push(s_main_window, true); } diff --git a/src/c/resources_service.c b/src/c/resources_service.c index d0c13b8..12ac89c 100644 --- a/src/c/resources_service.c +++ b/src/c/resources_service.c @@ -12,9 +12,9 @@ static ResourcesService *s_resources_service; void resources_service_init(void) { s_resources_service = malloc(sizeof(ResourcesService)); s_resources_service->font_koneko_toro = - fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_KONEKO_TORO_28)); + fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_KONEKO_TORO_24)); s_resources_service->font_toro = - fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TORO_38)); + fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TORO_36)); s_resources_service->character_even = gbitmap_create_with_resource(RESOURCE_ID_CHARACTER_EVEN); s_resources_service->character_odd = gbitmap_create_with_resource(RESOURCE_ID_CHARACTER_ODD); }