Add base text layers

This commit is contained in:
2026-07-30 21:16:25 -04:00
parent 2308cc834e
commit 86e99b361a
3 changed files with 79 additions and 10 deletions
+50 -2
View File
@@ -1,5 +1,53 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" version="1.1" style="shape-rendering:geometricPrecision;text-rendering:geometricPrecision;image-rendering:optimizeQuality;" viewBox="0 0 847 1058.75" x="0px" y="0px" fill-rule="evenodd" clip-rule="evenodd"><defs><style type="text/css"> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xml:space="preserve"
version="1.1"
style="image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
viewBox="0 0 50 50"
x="0px"
y="0px"
fill-rule="evenodd"
clip-rule="evenodd"
id="svg2"
sodipodi:docname="check.svg"
width="50"
height="50"
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
id="namedview2"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="11.327066"
inkscape:cx="31.120151"
inkscape:cy="39.771994"
inkscape:window-width="1524"
inkscape:window-height="1631"
inkscape:window-x="20"
inkscape:window-y="20"
inkscape:window-maximized="0"
inkscape:current-layer="g1" /><defs
id="defs1"><style
type="text/css"
id="style1">
.fil0 {fill:black} .fil0 {fill:black}
</style></defs><g><polygon class="fil0" points="308,507 708,107 824,223 308,739 23,455 139,339 "/></g><text x="0" y="862" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">Created by Asmuh</text><text x="0" y="867" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">from the Noun Project</text></svg> </style></defs><g
id="g1"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:68.2432;stroke-dasharray:none;stroke-opacity:1;stroke-linejoin:round"
transform="matrix(0.04462194,0,0,0.04330862,6.1035553,6.6813712)"><polygon
class="fil0"
points="23,455 139,339 308,507 708,107 824,223 308,739 "
id="polygon1"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:68.24327462;stroke-dasharray:none;stroke-opacity:1;stroke-linejoin:round;paint-order:normal;stroke-linecap:round"
inkscape:export-filename="../resources/check~color.png"
inkscape:export-xdpi="99.001747"
inkscape:export-ydpi="99.001747" /></g></svg>

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 1.9 KiB

+5 -5
View File
@@ -27,8 +27,8 @@
inkscape:zoom="12.586501" inkscape:zoom="12.586501"
inkscape:cx="20.02145" inkscape:cx="20.02145"
inkscape:cy="24.748737" inkscape:cy="24.748737"
inkscape:window-width="1524" inkscape:window-width="3056"
inkscape:window-height="793" inkscape:window-height="1631"
inkscape:window-x="20" inkscape:window-x="20"
inkscape:window-y="20" inkscape:window-y="20"
inkscape:window-maximized="0" inkscape:window-maximized="0"
@@ -138,7 +138,7 @@
y2="27.5" y2="27.5"
id="line6" id="line6"
inkscape:label="minuteHand" inkscape:label="minuteHand"
inkscape:export-filename="../resources/clock50~color.png" inkscape:export-filename="../resources/clock35~color.png"
inkscape:export-xdpi="115.67793" inkscape:export-xdpi="80.974548"
inkscape:export-ydpi="115.67793" /> inkscape:export-ydpi="80.974548" />
</svg> </svg>

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

+24 -3
View File
@@ -6,6 +6,8 @@ static Layer *s_top_bar_layer;
static Layer *s_bottom_bar_layer; static Layer *s_bottom_bar_layer;
static BitmapLayer *s_clock_bmp_layer; static BitmapLayer *s_clock_bmp_layer;
static BitmapLayer *s_check_bmp_layer; static BitmapLayer *s_check_bmp_layer;
static TextLayer *s_remaining_txt_layer;
static TextLayer *s_setter_txt_layer;
// bitmaps // bitmaps
static GBitmap *s_clock_bmp; static GBitmap *s_clock_bmp;
@@ -30,16 +32,16 @@ static void rect_fill_layer_update_proc(Layer *layer, GContext *ctx) {
static void setter_window_load() { static void setter_window_load() {
// top&bottom bars // top&bottom bars
GRect top_bar_grect = GRect(0, 0, PBL_DISPLAY_WIDTH, s_edge_bar_height); static const GRect top_bar_grect = GRect(0, 0, PBL_DISPLAY_WIDTH, s_edge_bar_height);
s_top_bar_layer = layer_create(top_bar_grect); s_top_bar_layer = layer_create(top_bar_grect);
layer_set_update_proc(s_top_bar_layer, rect_fill_layer_update_proc); layer_set_update_proc(s_top_bar_layer, rect_fill_layer_update_proc);
GRect bottom_bar_grect = GRect(0, PBL_DISPLAY_HEIGHT - s_edge_bar_height, PBL_DISPLAY_WIDTH, s_edge_bar_height); static const GRect bottom_bar_grect = GRect(0, PBL_DISPLAY_HEIGHT - s_edge_bar_height, PBL_DISPLAY_WIDTH, s_edge_bar_height);
s_bottom_bar_layer = layer_create(bottom_bar_grect); s_bottom_bar_layer = layer_create(bottom_bar_grect);
layer_set_update_proc(s_bottom_bar_layer, rect_fill_layer_update_proc); layer_set_update_proc(s_bottom_bar_layer, rect_fill_layer_update_proc);
// clock icon // clock icon
s_clock_bmp = gbitmap_create_with_resource(RESOURCE_ID_CLOCK35); s_clock_bmp = gbitmap_create_with_resource(RESOURCE_ID_CLOCK35);
s_clock_bmp_layer = bitmap_layer_create(GRect(PBL_IF_ROUND_ELSE(0, 8), PBL_IF_ROUND_ELSE(8, 0), top_bar_grect.size.w, top_bar_grect.size.h)); s_clock_bmp_layer = bitmap_layer_create(GRect(PBL_IF_ROUND_ELSE(0, 8), PBL_IF_ROUND_ELSE(6, 0), top_bar_grect.size.w, top_bar_grect.size.h));
bitmap_layer_set_bitmap(s_clock_bmp_layer, s_clock_bmp); bitmap_layer_set_bitmap(s_clock_bmp_layer, s_clock_bmp);
bitmap_layer_set_alignment(s_clock_bmp_layer, PBL_IF_ROUND_ELSE(GAlignTop, GAlignLeft)); bitmap_layer_set_alignment(s_clock_bmp_layer, PBL_IF_ROUND_ELSE(GAlignTop, GAlignLeft));
bitmap_layer_set_compositing_mode(s_clock_bmp_layer, GCompOpSet); bitmap_layer_set_compositing_mode(s_clock_bmp_layer, GCompOpSet);
@@ -50,14 +52,33 @@ static void setter_window_load() {
bitmap_layer_set_bitmap(s_check_bmp_layer, s_check_bmp); bitmap_layer_set_bitmap(s_check_bmp_layer, s_check_bmp);
bitmap_layer_set_compositing_mode(s_check_bmp_layer, GCompOpSet); bitmap_layer_set_compositing_mode(s_check_bmp_layer, GCompOpSet);
// remaining time
s_remaining_txt_layer = text_layer_create(GRect(PBL_IF_ROUND_ELSE(0, 39), PBL_IF_ROUND_ELSE(37, (top_bar_grect.size.h / 2) - (top_bar_grect.size.h / 3)), PBL_IF_ROUND_ELSE(top_bar_grect.size.w, top_bar_grect.size.w - 39), 32));
text_layer_set_text_alignment(s_remaining_txt_layer, GTextAlignmentCenter);
text_layer_set_text_color(s_remaining_txt_layer, GColorWhite);
text_layer_set_background_color(s_remaining_txt_layer, GColorClear);
text_layer_set_font(s_remaining_txt_layer, fonts_get_system_font(FONT_KEY_LECO_32_BOLD_NUMBERS));
text_layer_set_text(s_remaining_txt_layer, "00:00:00");
// setter
s_setter_txt_layer = text_layer_create(GRect(0, (PBL_DISPLAY_HEIGHT / 2) - 39, PBL_DISPLAY_WIDTH, 60));
text_layer_set_text_alignment(s_setter_txt_layer, GTextAlignmentCenter);
text_layer_set_background_color(s_setter_txt_layer, GColorClear);
text_layer_set_font(s_setter_txt_layer, fonts_get_system_font(FONT_KEY_LECO_60_NUMBERS_AM_PM));
text_layer_set_text(s_setter_txt_layer, PBL_IF_ROUND_ELSE("00 : 00", "00:00"));
Layer *window_layer = window_get_root_layer(s_window); Layer *window_layer = window_get_root_layer(s_window);
layer_add_child(window_layer, s_top_bar_layer); layer_add_child(window_layer, s_top_bar_layer);
layer_add_child(window_layer, s_bottom_bar_layer); layer_add_child(window_layer, s_bottom_bar_layer);
layer_add_child(window_layer, bitmap_layer_get_layer(s_clock_bmp_layer)); layer_add_child(window_layer, bitmap_layer_get_layer(s_clock_bmp_layer));
layer_add_child(window_layer, bitmap_layer_get_layer(s_check_bmp_layer)); layer_add_child(window_layer, bitmap_layer_get_layer(s_check_bmp_layer));
layer_add_child(window_layer, text_layer_get_layer(s_remaining_txt_layer));
layer_add_child(window_layer, text_layer_get_layer(s_setter_txt_layer));
} }
static void setter_window_unload() { static void setter_window_unload() {
text_layer_destroy(s_setter_txt_layer);
text_layer_destroy(s_remaining_txt_layer);
bitmap_layer_destroy(s_check_bmp_layer); bitmap_layer_destroy(s_check_bmp_layer);
bitmap_layer_destroy(s_clock_bmp_layer); bitmap_layer_destroy(s_clock_bmp_layer);
gbitmap_destroy(s_check_bmp); gbitmap_destroy(s_check_bmp);