Refine layout and bar direction
- Date font: Leco 38 Bold → Leco 28 Light - Countdown bar fills right-to-left (time remaining shrinks from right) - Time and date pulled close to the bar (4px gap each side) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,7 @@ static void bar_draw(Layer *layer, GContext *ctx) {
|
||||
for (int i = 0; i < 30; i++) {
|
||||
int x = start_x + i * (block_w + 1);
|
||||
GRect block = GRect(x, 0, block_w, bounds.size.h);
|
||||
if (i < s_bar_fill) {
|
||||
if (i >= 30 - s_bar_fill) {
|
||||
graphics_context_set_fill_color(ctx, GColorWhite);
|
||||
graphics_fill_rect(ctx, block, 0, GCornerNone);
|
||||
} else {
|
||||
@@ -108,8 +108,8 @@ static void main_window_load(Window *window) {
|
||||
Layer *root = window_get_root_layer(window);
|
||||
GRect bounds = layer_get_bounds(root);
|
||||
|
||||
// Time — Leco 42, centred
|
||||
s_time_layer = text_layer_create(GRect(0, 30, bounds.size.w, 52));
|
||||
// Time — Leco 42, centred, flush to bar
|
||||
s_time_layer = text_layer_create(GRect(0, 34, bounds.size.w, 52));
|
||||
text_layer_set_background_color(s_time_layer, GColorClear);
|
||||
text_layer_set_text_color(s_time_layer, GColorWhite);
|
||||
text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_LECO_42_NUMBERS));
|
||||
@@ -117,16 +117,16 @@ static void main_window_load(Window *window) {
|
||||
text_layer_set_text(s_time_layer, "00:00");
|
||||
layer_add_child(root, text_layer_get_layer(s_time_layer));
|
||||
|
||||
// Countdown bar — 30 blocks between time and date
|
||||
// Countdown bar — 30 blocks, right-to-left
|
||||
s_bar_layer = layer_create(GRect(0, 90, bounds.size.w, 8));
|
||||
layer_set_update_proc(s_bar_layer, bar_draw);
|
||||
layer_add_child(root, s_bar_layer);
|
||||
|
||||
// Date — Leco 38, right-aligned
|
||||
s_date_layer = text_layer_create(GRect(0, 106, bounds.size.w, 44));
|
||||
// Date — Leco 28 Light, right-aligned, flush to bar
|
||||
s_date_layer = text_layer_create(GRect(0, 102, bounds.size.w, 34));
|
||||
text_layer_set_background_color(s_date_layer, GColorClear);
|
||||
text_layer_set_text_color(s_date_layer, GColorWhite);
|
||||
text_layer_set_font(s_date_layer, fonts_get_system_font(FONT_KEY_LECO_38_BOLD_NUMBERS));
|
||||
text_layer_set_font(s_date_layer, fonts_get_system_font(FONT_KEY_LECO_28_LIGHT_NUMBERS));
|
||||
text_layer_set_text_alignment(s_date_layer, GTextAlignmentRight);
|
||||
text_layer_set_text(s_date_layer, "01/01");
|
||||
layer_add_child(root, text_layer_get_layer(s_date_layer));
|
||||
|
||||
Reference in New Issue
Block a user