Destroy s_bt_layer; fix head swapping

This commit is contained in:
2026-03-20 00:34:10 -04:00
parent 3627069998
commit 95d222db21

View File

@@ -21,7 +21,7 @@ static GBitmap *s_head_current;
static GBitmap *s_butt_current;
static GBitmap *s_head_next;
static GBitmap *s_butt_next;
static GBitmap *s_bt;
static GBitmap *s_bt_icon;
// 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);
@@ -194,7 +194,7 @@ static void update_minute_60() {
s_head_in_anim = animation_clone(s_head_out_anim);
animation_set_reverse(s_head_in_anim, true);
// set handler on out (after clone)
animation_set_handlers(s_head_out_anim, (AnimationHandlers){.stopped = update_minute_30_out_handler}, NULL);
animation_set_handlers(s_head_out_anim, (AnimationHandlers){.stopped = update_minute_60_out_handler}, NULL);
// back to resting
s_head_rest_anim = animation_clone(s_head_raise_anim);
animation_set_reverse(s_head_rest_anim, true);
@@ -256,7 +256,7 @@ static void main_window_load(Window *window) {
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);
bitmap_layer_set_bitmap(s_bt_layer, s_bt_icon);
// 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));
@@ -289,6 +289,7 @@ static void main_window_unload(Window *window) {
bitmap_layer_destroy(s_guy_butt_layer);
text_layer_destroy(s_time_layer);
text_layer_destroy(s_date_layer);
bitmap_layer_destroy(s_bt_layer);
layer_destroy(s_time_bar_layer);
// DEBUG memory usage layer
@@ -340,7 +341,7 @@ static void init() {
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);
s_bt_icon = gbitmap_create_with_resource(RESOURCE_ID_BT);
// show the Window on the watch, with animated=true
window_stack_push(s_main_window, true);
@@ -365,7 +366,7 @@ static void deinit() {
gbitmap_destroy(s_butt_current);
gbitmap_destroy(s_head_next);
gbitmap_destroy(s_butt_next);
gbitmap_destroy(s_bt);
gbitmap_destroy(s_bt_icon);
// destroy window
window_destroy(s_main_window);