void handle_tick(AppContextRef app_ctx, PebbleTickEvent *event) { time_layer_set_time(&time_layer, *(event->tick_time)); if(precip_forecast_index >= 0) { ++precip_forecast_index; if(precip_forecast_index > 60) { weather_layer_clear_precipitation_forecast(&weather_layer); precip_forecast_index = -1; } else { weather_layer_set_precipitation_forecast(&weather_layer, &precip_forecast[precip_forecast_index], 60 - precip_forecast_index); } } }
void handle_init(AppContextRef ctx) { resource_init_current_app(&APP_RESOURCES); window_init(&window, "Weather Watch"); window_stack_push(&window, true /* Animated */); window_set_fullscreen(&window, true); // Add time layer. time_layer_init(&time_layer, GPoint(0, 0)); layer_add_child(&window.layer, &time_layer.layer); // Set initial time. PblTm time; get_time(&time); time_layer_set_time(&time_layer, time); // Add weather layer weather_layer_init(&weather_layer, GPoint(0, 100)); layer_add_child(&window.layer, &weather_layer.layer); http_register_callbacks((HTTPCallbacks){.failure=failed,.success=success,.reconnect=reconnect,.location=location}, (void*)ctx);
void handle_tick(AppContextRef app_ctx, PebbleTickEvent *event) { time_layer_set_time(&time_layer, *(event->tick_time)); }