Add pin icon
This commit is contained in:
4
custom_assets/pin_icon_alignment_fix.svg
Normal file
4
custom_assets/pin_icon_alignment_fix.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M22 18L16 21L11 20L5 18L3 14L9 13L12 2H16L20 5L17 15L22 18Z" fill="white"/>
|
||||
<path d="M12 17L10 24M9 13L3 14L5 18L16 21L22 18L17 15M9 13L13 13L17 15M9 13L12 2H16L20 5L17 15" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 366 B |
@@ -34,6 +34,11 @@
|
||||
"type": "raw",
|
||||
"name": "SLEEP_ICON",
|
||||
"file": "sleep.pdc"
|
||||
},
|
||||
{
|
||||
"type": "raw",
|
||||
"name": "PIN_ICON",
|
||||
"file": "pin.pdc"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
BIN
resources/pin.pdc
Normal file
BIN
resources/pin.pdc
Normal file
Binary file not shown.
13
src/c/main.c
13
src/c/main.c
@@ -9,7 +9,9 @@ static TextLayer *s_last_watched_layer;
|
||||
static Layer *s_button_bar_layer;
|
||||
static Layer *s_sleep_bar_layer;
|
||||
static Layer *s_sleep_icon_layer;
|
||||
static Layer *s_pin_icon_layer;
|
||||
static GDrawCommandImage *s_sleep_icon;
|
||||
static GDrawCommandImage *s_pin_icon;
|
||||
|
||||
// declare time tracking statics
|
||||
static time_t s_sleep_timestamp;
|
||||
@@ -73,6 +75,11 @@ static void sleep_icon_update_proc(Layer *layer, GContext *ctx) {
|
||||
gdraw_command_image_draw(ctx, s_sleep_icon, GPoint(0, 0));
|
||||
}
|
||||
|
||||
static void pin_icon_update_proc(Layer *layer, GContext *ctx) {
|
||||
graphics_context_set_antialiased(ctx, false);
|
||||
gdraw_command_image_draw(ctx, s_pin_icon, GPoint(0, 0));
|
||||
}
|
||||
|
||||
static void main_window_load(Window *window) {
|
||||
// sleep bar
|
||||
s_sleep_bar_layer = layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_IF_ROUND_ELSE(49, 31)));
|
||||
@@ -82,6 +89,10 @@ static void main_window_load(Window *window) {
|
||||
s_sleep_icon_layer = layer_create(GRect(PBL_IF_ROUND_ELSE((PBL_DISPLAY_WIDTH / 2) - 13, 4), 4, PBL_DISPLAY_WIDTH, 50));
|
||||
layer_set_update_proc(s_sleep_icon_layer, sleep_icon_update_proc);
|
||||
|
||||
// pin icon
|
||||
s_pin_icon_layer = layer_create(GRect(PBL_DISPLAY_WIDTH-25, (PBL_DISPLAY_HEIGHT/2)-13, 50, 50));
|
||||
layer_set_update_proc(s_pin_icon_layer, pin_icon_update_proc);
|
||||
|
||||
// sleep time
|
||||
s_sleep_time_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(24, -2), PBL_DISPLAY_WIDTH, 30));
|
||||
text_layer_set_background_color(s_sleep_time_layer, GColorClear);
|
||||
@@ -126,6 +137,7 @@ static void main_window_load(Window *window) {
|
||||
layer_set_update_proc(s_button_bar_layer, button_bar_update_proc);
|
||||
layer_add_child(window_layer, s_button_bar_layer);
|
||||
#endif
|
||||
layer_add_child(window_layer, s_pin_icon_layer);
|
||||
layer_add_child(window_layer, s_sleep_bar_layer);
|
||||
layer_add_child(window_layer, s_sleep_icon_layer);
|
||||
layer_add_child(window_layer, text_layer_get_layer(s_sleep_time_layer));
|
||||
@@ -164,6 +176,7 @@ static void init() {
|
||||
|
||||
// load PDCs
|
||||
s_sleep_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_SLEEP_ICON);
|
||||
s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ICON);
|
||||
|
||||
window_stack_push(s_main_window, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user