Add (not yet functional) bluetooth indicator
This commit is contained in:
11
package.json
11
package.json
@@ -571,6 +571,17 @@
|
|||||||
],
|
],
|
||||||
"type": "bitmap"
|
"type": "bitmap"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"file": "images/bt.png",
|
||||||
|
"memoryFormat": "Smallest",
|
||||||
|
"name": "BT",
|
||||||
|
"spaceOptimization": "storage",
|
||||||
|
"targetPlatforms": [
|
||||||
|
"emery",
|
||||||
|
"gabbro"
|
||||||
|
],
|
||||||
|
"type": "bitmap"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"characterRegex": "[:0-9]",
|
"characterRegex": "[:0-9]",
|
||||||
"file": "fonts/RetroComputerTime.ttf",
|
"file": "fonts/RetroComputerTime.ttf",
|
||||||
|
|||||||
BIN
resources/images/bt.png
Normal file
BIN
resources/images/bt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 128 B |
17
src/c/main.c
17
src/c/main.c
@@ -7,6 +7,7 @@ static GFont s_custom_font;
|
|||||||
static Layer *s_time_bar_layer;
|
static Layer *s_time_bar_layer;
|
||||||
static TextLayer *s_time_layer;
|
static TextLayer *s_time_layer;
|
||||||
static TextLayer *s_date_layer;
|
static TextLayer *s_date_layer;
|
||||||
|
static BitmapLayer *s_bt_layer;
|
||||||
static BitmapLayer *s_guy_head_layer;
|
static BitmapLayer *s_guy_head_layer;
|
||||||
static BitmapLayer *s_guy_butt_layer;
|
static BitmapLayer *s_guy_butt_layer;
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ static GBitmap *s_head_current;
|
|||||||
static GBitmap *s_butt_current;
|
static GBitmap *s_butt_current;
|
||||||
static GBitmap *s_head_next;
|
static GBitmap *s_head_next;
|
||||||
static GBitmap *s_butt_next;
|
static GBitmap *s_butt_next;
|
||||||
|
static GBitmap *s_bt;
|
||||||
|
|
||||||
// declare positions for animation stages
|
// declare positions for animation stages
|
||||||
static GRect s_guy_head_grect_on_screen_raised = GRect(PBL_IF_ROUND_ELSE(0, -30), PBL_IF_ROUND_ELSE(-15, -31), 260, 115);
|
static GRect s_guy_head_grect_on_screen_raised = GRect(PBL_IF_ROUND_ELSE(0, -30), PBL_IF_ROUND_ELSE(-15, -31), 260, 115);
|
||||||
@@ -75,7 +77,7 @@ static void update_minute_1() {
|
|||||||
|
|
||||||
// write the current date into a buffer & format
|
// write the current date into a buffer & format
|
||||||
static char s_date_buffer[16];
|
static char s_date_buffer[16];
|
||||||
strftime(s_date_buffer, sizeof(s_date_buffer), "%m/%d", tick_time);
|
strftime(s_date_buffer, sizeof(s_date_buffer), "%m.%d", tick_time);
|
||||||
|
|
||||||
text_layer_set_text(s_time_layer, s_time_buffer);
|
text_layer_set_text(s_time_layer, s_time_buffer);
|
||||||
text_layer_set_text(s_date_layer, s_date_buffer);
|
text_layer_set_text(s_date_layer, s_date_buffer);
|
||||||
@@ -205,9 +207,15 @@ static void main_window_load(Window *window) {
|
|||||||
// format date layer
|
// format date layer
|
||||||
s_date_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(121, 105), PBL_IF_ROUND_ELSE(69, 39), 14));
|
s_date_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(121, 105), PBL_IF_ROUND_ELSE(69, 39), 14));
|
||||||
text_layer_set_background_color(s_date_layer, GColorClear);
|
text_layer_set_background_color(s_date_layer, GColorClear);
|
||||||
text_layer_set_font(s_date_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));
|
text_layer_set_font(s_date_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD));
|
||||||
text_layer_set_text_alignment(s_date_layer, GTextAlignmentCenter);
|
text_layer_set_text_alignment(s_date_layer, GTextAlignmentCenter);
|
||||||
|
|
||||||
|
// format BT indicator layer
|
||||||
|
s_bt_layer = bitmap_layer_create(GRect(PBL_IF_ROUND_ELSE(191, 161), PBL_IF_ROUND_ELSE(118, 102), PBL_IF_ROUND_ELSE(69, 39), 24));
|
||||||
|
bitmap_layer_set_compositing_mode(s_bt_layer, GCompOpSet);
|
||||||
|
bitmap_layer_set_alignment(s_bt_layer, GAlignCenter);
|
||||||
|
bitmap_layer_set_bitmap(s_bt_layer, s_bt);
|
||||||
|
|
||||||
// create time bar layer
|
// create time bar layer
|
||||||
s_time_bar_layer = layer_create(GRect(0, PBL_IF_ROUND_ELSE(115, 99), PBL_IF_ROUND_ELSE(260, 200), 30));
|
s_time_bar_layer = layer_create(GRect(0, PBL_IF_ROUND_ELSE(115, 99), PBL_IF_ROUND_ELSE(260, 200), 30));
|
||||||
layer_set_update_proc(s_time_bar_layer, time_bar_update_proc);
|
layer_set_update_proc(s_time_bar_layer, time_bar_update_proc);
|
||||||
@@ -219,6 +227,7 @@ static void main_window_load(Window *window) {
|
|||||||
layer_add_child(window_layer, s_time_bar_layer);
|
layer_add_child(window_layer, s_time_bar_layer);
|
||||||
layer_add_child(window_layer, text_layer_get_layer(s_time_layer));
|
layer_add_child(window_layer, text_layer_get_layer(s_time_layer));
|
||||||
layer_add_child(window_layer, text_layer_get_layer(s_date_layer));
|
layer_add_child(window_layer, text_layer_get_layer(s_date_layer));
|
||||||
|
layer_add_child(window_layer, bitmap_layer_get_layer(s_bt_layer));
|
||||||
}
|
}
|
||||||
|
|
||||||
// free memory on Window close;
|
// free memory on Window close;
|
||||||
@@ -275,6 +284,9 @@ static void init() {
|
|||||||
// load custom font
|
// load custom font
|
||||||
s_custom_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_RETRO_COMPUTER_34));
|
s_custom_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_RETRO_COMPUTER_34));
|
||||||
|
|
||||||
|
// load bluetooth indicator
|
||||||
|
s_bt = gbitmap_create_with_resource(RESOURCE_ID_BT);
|
||||||
|
|
||||||
// show the Window on the watch, with animated=true
|
// show the Window on the watch, with animated=true
|
||||||
window_stack_push(s_main_window, true);
|
window_stack_push(s_main_window, true);
|
||||||
|
|
||||||
@@ -295,6 +307,7 @@ static void deinit() {
|
|||||||
gbitmap_destroy(s_butt_current);
|
gbitmap_destroy(s_butt_current);
|
||||||
gbitmap_destroy(s_head_next);
|
gbitmap_destroy(s_head_next);
|
||||||
gbitmap_destroy(s_butt_next);
|
gbitmap_destroy(s_butt_next);
|
||||||
|
gbitmap_destroy(s_bt);
|
||||||
window_destroy(s_main_window);
|
window_destroy(s_main_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user