Use custom, monospaced version of LECO font
This commit is contained in:
+17
-12
@@ -1,3 +1,4 @@
|
||||
#include "src/resource_ids.auto.h"
|
||||
#include <pebble.h>
|
||||
|
||||
// types
|
||||
@@ -33,7 +34,7 @@ static const GColor s_highlight_color = GColorMediumAquamarine;
|
||||
|
||||
/////////////////////////////////
|
||||
|
||||
static void update_countdown_display(struct tm *tick_time, TimeUnits units_changed) {
|
||||
static void seconds_handler(struct tm *tick_time, TimeUnits units_changed) {
|
||||
struct tm now_tm = *tick_time;
|
||||
|
||||
// Build the target time today
|
||||
@@ -61,9 +62,14 @@ static void update_countdown_display(struct tm *tick_time, TimeUnits units_chang
|
||||
text_layer_set_text(s_countdown_txt_layer, s_countdown_buffer);
|
||||
}
|
||||
|
||||
static void update_countdown_display() {
|
||||
time_t now = time(NULL);
|
||||
seconds_handler(localtime(&now), SECOND_UNIT);
|
||||
}
|
||||
|
||||
static void update_setter_display() {
|
||||
static char s_setter_buffer[8];
|
||||
snprintf(s_setter_buffer, sizeof(s_setter_buffer), "%02d:%02d", s_setter_time.HourWIP, s_setter_time.MinuteWIP);
|
||||
snprintf(s_setter_buffer, sizeof(s_setter_buffer), PBL_IF_ROUND_ELSE("%02d:%02d", "%02d:%02d"), s_setter_time.HourWIP, s_setter_time.MinuteWIP);
|
||||
text_layer_set_text(s_setter_txt_layer, s_setter_buffer);
|
||||
}
|
||||
|
||||
@@ -115,8 +121,7 @@ static void select_click_handler(void *recognizer, void *ctx) {
|
||||
if (s_highlight_pos == 2) {
|
||||
s_setter_time.HourSet = s_setter_time.HourWIP;
|
||||
s_setter_time.MinuteSet = s_setter_time.MinuteWIP;
|
||||
time_t now = time(NULL);
|
||||
update_countdown_display(localtime(&now), SECOND_UNIT);
|
||||
update_countdown_display();
|
||||
s_highlight_pos = 0;
|
||||
} else {
|
||||
s_highlight_pos++;
|
||||
@@ -200,14 +205,14 @@ static void setter_window_load() {
|
||||
bitmap_layer_set_compositing_mode(s_check_bmp_layer, GCompOpSet);
|
||||
layer_add_child(window_layer, bitmap_layer_get_layer(s_check_bmp_layer));
|
||||
|
||||
// remaining time
|
||||
s_countdown_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));
|
||||
// countdown
|
||||
s_countdown_txt_layer = text_layer_create(GRect(PBL_IF_ROUND_ELSE(0, 39), (top_bar_grect.size.h / 2) + PBL_IF_ROUND_ELSE(10, -10), PBL_IF_ROUND_ELSE(top_bar_grect.size.w, top_bar_grect.size.w - 39), 32));
|
||||
text_layer_set_text_alignment(s_countdown_txt_layer, GTextAlignmentCenter);
|
||||
text_layer_set_text_color(s_countdown_txt_layer, GColorWhite);
|
||||
text_layer_set_background_color(s_countdown_txt_layer, GColorClear);
|
||||
text_layer_set_font(s_countdown_txt_layer, fonts_get_system_font(FONT_KEY_LECO_32_BOLD_NUMBERS));
|
||||
text_layer_set_text(s_countdown_txt_layer, "00:00:00");
|
||||
text_layer_set_font(s_countdown_txt_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_LECOISH_MONO_BOLD_20)));
|
||||
layer_add_child(window_layer, text_layer_get_layer(s_countdown_txt_layer));
|
||||
update_countdown_display();
|
||||
|
||||
// highlighter
|
||||
s_highlight_layer = layer_create(GRect(0, top_bar_grect.size.h, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT - (2 * top_bar_grect.size.h)));
|
||||
@@ -215,14 +220,14 @@ static void setter_window_load() {
|
||||
layer_add_child(window_layer, s_highlight_layer);
|
||||
|
||||
// setter
|
||||
s_setter_txt_layer = text_layer_create(GRect(0, (PBL_DISPLAY_HEIGHT / 2) - 39, PBL_DISPLAY_WIDTH, 60));
|
||||
s_setter_txt_layer = text_layer_create(GRect(0, (PBL_DISPLAY_HEIGHT / 2) - PBL_IF_ROUND_ELSE(30, 20), PBL_DISPLAY_WIDTH, PBL_IF_ROUND_ELSE(60, 40)));
|
||||
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"));
|
||||
text_layer_set_font(s_setter_txt_layer, fonts_load_custom_font(resource_get_handle(PBL_IF_ROUND_ELSE(RESOURCE_ID_FONT_LECOISH_MONO_BOLD_60, RESOURCE_ID_FONT_LECOISH_MONO_BOLD_40))));
|
||||
layer_add_child(window_layer, text_layer_get_layer(s_setter_txt_layer));
|
||||
update_setter_display();
|
||||
|
||||
tick_timer_service_subscribe(SECOND_UNIT, update_countdown_display);
|
||||
tick_timer_service_subscribe(SECOND_UNIT, seconds_handler);
|
||||
}
|
||||
|
||||
static void setter_window_unload() {
|
||||
|
||||
Reference in New Issue
Block a user