Esempio n. 1
0
void handle_init(AppContextRef ctx) {
  // Create the main window and push it in fullscreen mode
  window_init(&window, "Window Name");
  window_stack_push(&window, true /* Animated */);
  window_set_fullscreen(&window, true);

  // Initialize ressources and load the background image
  resource_init_current_app(&APP_RESOURCES);
  bmp_init_container(RESOURCE_ID_BACKGROUND_IMAGE, &background_image);
  layer_add_child(&window.layer, &background_image.layer.layer);

  // Create a text field to display the time until the next pass
  text_layer_init(&nextpass_text_layer, GRect(0, 126, 144, 34));
  text_layer_set_font(&nextpass_text_layer, fonts_get_system_font(FONT_KEY_BITHAM_34_MEDIUM_NUMBERS));
  text_layer_set_text_alignment(&nextpass_text_layer, GTextAlignmentCenter);
  text_layer_set_background_color(&nextpass_text_layer, GColorClear);
  layer_add_child(window_get_root_layer(&window), (Layer*)&time_text_layer);

  // Create a text field to display the current time
  text_layer_init(&time_text_layer, GRect(37, 0, 70, 24));
  text_layer_set_font(&time_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
  text_layer_set_text_alignment(&time_text_layer, GTextAlignmentCenter);
  text_layer_set_background_color(&time_text_layer, GColorClear);
  layer_add_child(window_get_root_layer(&window), (Layer*)&nextpass_text_layer);


  // Add background and both text fields to the window

  // Start an HTTP Request
  start_http_request();
}
Esempio n. 2
0
File: plain.c Progetto: 7bp/pebble
void handle_init(AppContextRef ctx) {
  (void)ctx;

  window_init(&window, "Plain Watch");
  window_stack_push(&window, true /* Animated */);
  window_set_background_color(&window, GColorBlack);

  resource_init_current_app(&APP_RESOURCES);

  layer_init(&hour_display_layer, window.layer.frame);
  hour_display_layer.update_proc = &hour_display_layer_update_callback;
  layer_add_child(&window.layer, &hour_display_layer);

  gpath_init(&hour_hand_outline_path, &HOUR_HAND_OUTLINE_PATH_POINTS);
  gpath_move_to(&hour_hand_outline_path, grect_center_point(&hour_display_layer.frame));
  gpath_init(&hour_hand_path, &HOUR_HAND_PATH_POINTS);
  gpath_move_to(&hour_hand_path, grect_center_point(&hour_display_layer.frame));

  layer_init(&minute_display_layer, window.layer.frame);
  minute_display_layer.update_proc = &minute_display_layer_update_callback;
  layer_add_child(&window.layer, &minute_display_layer);

  gpath_init(&minute_hand_outline_path, &MINUTE_HAND_OUTLINE_PATH_POINTS);
  gpath_move_to(&minute_hand_outline_path, grect_center_point(&minute_display_layer.frame));
  gpath_init(&minute_hand_path, &MINUTE_HAND_PATH_POINTS);
  gpath_move_to(&minute_hand_path, grect_center_point(&minute_display_layer.frame));
}
Esempio n. 3
0
void handle_init(AppContextRef ctx) {
  (void)ctx;

  window_init(&window, "Main");
  window_stack_push(&window, true /* Animated */);
  window_set_background_color(&window, GColorBlack);
  resource_init_current_app(&APP_RESOURCES);

  frame_animation_init(&gif_animation, &window.layer, GPoint(0,0), RESOURCE_ID_FRAME_1, 12, false, true);
  timer_handle = app_timer_send_event(ctx, 100, 1);


  text_layer_init(&text_time_layer, GRect(0, 5, 144, 30));
  text_layer_set_text_color(&text_time_layer, GColorWhite);
  text_layer_set_background_color(&text_time_layer, GColorClear);
  text_layer_set_text_alignment(&text_time_layer, GTextAlignmentCenter);
  text_layer_set_font(&text_time_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
  layer_add_child(&window.layer, &text_time_layer.layer);

  text_layer_init(&date_layer, GRect(0, 130, 144, 30));
  text_layer_set_text_color(&date_layer, GColorWhite);
  text_layer_set_background_color(&date_layer, GColorClear);
  text_layer_set_text_alignment(&date_layer, GTextAlignmentCenter);
  text_layer_set_font(&date_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
  layer_add_child(&window.layer, &date_layer.layer);

}
Esempio n. 4
0
void handle_init(AppContextRef ctx) {
	(void)ctx;
	
	app_ctx = ctx;

	window_init(&window, "Vibe");
	window_stack_push(&window, true /* Animated */);
    
	power = 3;
	on = false;
	
	resource_init_current_app(&APP_RESOURCES);
	
	layer_init(&controls_layer, GRect(124, 3, 20, 146));
	controls_layer.update_proc = &controls_update_callback;
	layer_add_child(&window.layer, &controls_layer);
	
	layer_init(&bars_layer, GRect(22, 22, 85, 115));
	bars_layer.update_proc = &bars_update_callback;
	layer_add_child(&window.layer, &bars_layer);
	
	bmp_init_container(RESOURCE_ID_IMAGE_CONTROLS, &controls);
	bmp_init_container(RESOURCE_ID_IMAGE_BAR_ON,   &bar_on);
	bmp_init_container(RESOURCE_ID_IMAGE_BAR_OFF,  &bar_off);
	
	window_set_click_config_provider(&window, (ClickConfigProvider) click_config_provider);
}
Esempio n. 5
0
static void
handle_init(
	AppContextRef ctx
)
{
	(void) ctx;

	window_init(&window, "Main");
	window_stack_push(&window, true);
	window_set_background_color(&window, GColorBlack);

//	resource_init_current_app(&RESOURCES);
	resource_init_current_app(&APP_RESOURCES);
	
	int y = 15;
	int h = 30;

	font_small = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_22));
	font_thin = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_28));
	font_thick = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_BLACK_30));

	// Stack top to bottom.  Note that the hour can take up
	// two rows at midnight.
	text_layer(&ampm_small_word, GRect(4, y + 3*h+2, 144, h+8), font_small);
	text_layer(&ampm_word, GRect(4, y + 3*h, 144, h+8), font_thin);

	text_layer(&hour_word, GRect(4, y + 2*h-2, 144, 2*h+8), font_thick);

	text_layer(&rel_small_word, GRect(4, y + 1*h+2, 144, h+8), font_small);
	text_layer(&rel_word, GRect(4, y + 1*h, 144, h+8), font_thin);

	text_layer(&min_word, GRect(4, y + 0*h, 144, h+8), font_thin);


}
Esempio n. 6
0
void handle_init(AppContextRef ctx) {

  window_init(&window, "Simplicity");
  window_stack_push(&window, true /* Animated */);
  window_set_background_color(&window, GColorBlack);

  resource_init_current_app(&APP_RESOURCES);

  layer_init(&time_layer, GRect(0, 12, 144, 168-68));
  layer_add_child(&window.layer, &time_layer);

  text_layer_init(&text_date_layer, window.layer.frame);
  text_layer_set_text_color(&text_date_layer, GColorWhite);
  text_layer_set_background_color(&text_date_layer, GColorClear);
  layer_set_frame(&text_date_layer.layer, GRect(8, 0, 144-8, 168-68));
  text_layer_set_font(&text_date_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21)));
  layer_add_child(&time_layer, &text_date_layer.layer);


  text_layer_init(&text_time_layer, window.layer.frame);
  text_layer_set_text_color(&text_time_layer, GColorWhite);
  text_layer_set_background_color(&text_time_layer, GColorClear);
  layer_set_frame(&text_time_layer.layer, GRect(7, 24, 144-7, 168-92));
  text_layer_set_font(&text_time_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLD_SUBSET_49)));
  layer_add_child(&time_layer, &text_time_layer.layer);


  layer_init(&line_layer, window.layer.frame);
  line_layer.update_proc = &line_layer_update_callback;
  layer_add_child(&time_layer, &line_layer);

  layer_init(&car_layer, GRect(0, 90, 144, 168-90));
  layer_add_child(&window.layer, &car_layer);

  text_layer_init(&text_rated_layer, window.layer.frame);
  text_layer_set_text_color(&text_rated_layer, GColorWhite);
  text_layer_set_background_color(&text_rated_layer, GColorClear);
  layer_set_frame(&text_rated_layer.layer, GRect(8, 0, 144-8, 168-68));
  text_layer_set_font(&text_rated_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21)));
  layer_add_child(&car_layer, &text_rated_layer.layer);
	
  text_layer_init(&text_state_layer, window.layer.frame);
  text_layer_set_text_color(&text_state_layer, GColorWhite);
  text_layer_set_background_color(&text_state_layer, GColorClear);
  layer_set_frame(&text_state_layer.layer, GRect(8, 20, 144-8, 168-68));
  text_layer_set_font(&text_state_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21)));
  layer_add_child(&car_layer, &text_state_layer.layer);
	
  layer_init(&battery_layer, GRect(72, 10, 144-70, 10));
  battery_layer.update_proc = &battery_layer_update_callback;
  layer_add_child(&car_layer, &battery_layer);

  Tuplet initial_values[] = {
    TupletInteger(TESLA_RATED_REMAIN_KEY, (uint16_t) 148),
    TupletCString(TESLA_STATE_STRING_KEY, "Charging"),
	TupletInteger(TESLA_BATTERY_PERCENT_KEY, (uint8_t) 72),
  };
  app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values, ARRAY_LENGTH(initial_values),
                sync_tuple_changed_callback, sync_error_callback, NULL);
}
void handle_init(AppContextRef ctx) {
    (void)ctx;
    
    firstblood = true;
    
    window_init(&window, "Clock_Window");
    window_stack_push(&window, true /* Animated */);
    window_set_background_color(&window, GColorBlack);
    resource_init_current_app(&APP_RESOURCES);
    
    fontHour = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLDITALIC_35));
    fontUhr = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_LIGHTITALIC_30));
    fontMinutes = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_ITALIC_33));
    fontDate = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_ITALIC_13));
    
    memset(row_1_buffer,0,20);
    memset(row_3_buffer,0,20);
    memset(row_4_buffer,0,20);
    memset(row_5_buffer,0,20);
    
    text_layer_init(&row_2, window.layer.frame);
    text_layer_init(&row_3, window.layer.frame);
    text_layer_init(&row_4, window.layer.frame);
    text_layer_init(&row_5, window.layer.frame);
    text_layer_init(&row_3b, window.layer.frame);
    text_layer_init(&row_4b, window.layer.frame);
    text_layer_init(&row_5b, window.layer.frame);
    
    text_layer_init(&row_1, window.layer.frame);
    text_layer_init(&row_1b, window.layer.frame);
    
    get_time(&t);
}
Esempio n. 8
0
void handle_init(AppContextRef ctx) {
	Layer *rootLayer;
	int i;
	
	window_init(&window, "Minimalist");
	window_stack_push(&window, true /* Animated */);
	window_set_background_color(&window, GColorBlack);
	
	clock12 = !clock_is_24h_style();
	
	resource_init_current_app(&APP_RESOURCES);
	
	for (i=0; i<NUM_IMAGES; i++) {
		heap_bitmap_init(&digitBmp[i], digitId[i]);
#if WHITE_BACKGROUND
		bmpNegative(&digitBmp[i].bmp);
#endif
	}
	
	rootLayer = window_get_root_layer(&window);
	layer_init(&layer, GRect(0,0,SCREENW,SCREENH));
	layer_set_update_proc(&layer, &update_display);
	layer_add_child(rootLayer, &layer);
	
	handle_tick(ctx, NULL);
	//layer_mark_dirty(&layer);
}
Esempio n. 9
0
void handle_init(AppContextRef ctx) {
  (void)ctx;

  window_init(&window, "Orbit");
  window_stack_push(&window, false /* Not Animated */);
  window_set_background_color(&window, GColorBlack);

  resource_init_current_app(&RESOURCES);

  bmp_init_container(RESOURCE_ID_IMAGE_FACE, &faceImage);
  layer_add_child(&window.layer, &faceImage.layer.layer);

  rotbmp_pair_init_container(RESOURCE_ID_IMAGE_MINUTE_PLANET_WHITE, RESOURCE_ID_IMAGE_MINUTE_PLANET_BLACK, &minuteImage);
  layer_add_child(&window.layer, &minuteImage.layer.layer);

  rotbmp_pair_init_container(RESOURCE_ID_IMAGE_HOUR_PLANET_WHITE, RESOURCE_ID_IMAGE_HOUR_PLANET_BLACK, &hourImage);
  layer_add_child(&window.layer, &hourImage.layer.layer);

  text_layer_init(&minuteText, GRect(0,0,0,0));
  text_layer_set_text_color(&minuteText, GColorWhite);
  text_layer_set_background_color(&minuteText, GColorClear);
  text_layer_set_text_alignment(&minuteText, GTextAlignmentCenter);
  text_layer_set_font(&minuteText, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_14)));
  layer_add_child(&window.layer, &minuteText.layer);

  text_layer_init(&hourText, GRect(0,0,0,0));
  text_layer_set_text_color(&hourText, GColorWhite);
  text_layer_set_background_color(&hourText, GColorClear);
  text_layer_set_text_alignment(&hourText, GTextAlignmentCenter);
  text_layer_set_font(&hourText, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_22)));
  layer_add_child(&window.layer, &hourText.layer);

  update_rings();
}
// Handle the start-up of the app
void handle_init(AppContextRef app_ctx) {

	// Create our app's base window
	window_init(&window, "Silly Walk");
	window_stack_push(&window, true);
	window_set_background_color(&window, GColorBlack);

	resource_init_current_app(&APP_RESOURCES);

	// Set up a layer for the static watch face background
	bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image_container);
	layer_add_child(&window.layer, &background_image_container.layer.layer);


	// Set up a layer for the hour hand
	rotbmp_pair_init_container(RESOURCE_ID_IMAGE_HOUR_HAND_WHITE, RESOURCE_ID_IMAGE_HOUR_HAND_BLACK, &hour_hand_image_container);
	rotbmp_pair_layer_set_src_ic(&hour_hand_image_container.layer, GPoint(33, 40));
	layer_add_child(&window.layer, &hour_hand_image_container.layer.layer);


	// Set up a layer for the minute hand
	rotbmp_pair_init_container(RESOURCE_ID_IMAGE_MINUTE_HAND_WHITE, RESOURCE_ID_IMAGE_MINUTE_HAND_BLACK, &minute_hand_image_container);
	rotbmp_pair_layer_set_src_ic(&minute_hand_image_container.layer, GPoint(16, 60));
	layer_add_child(&window.layer, &minute_hand_image_container.layer.layer);


	PblTm t;
	get_time(&t);
	update_watch(&t);

}
Esempio n. 11
0
void handle_init(AppContextRef ctx) {
    memset(&background_image, 0, sizeof(background_image));
    memset(&day_name_image, 0, sizeof(day_name_image));
    memset(&date_digits_images, 0, sizeof(date_digits_images));
    memset(&time_digits_images, 0, sizeof(time_digits_images));
    memset(&digits, 0, sizeof(digits));
    memset(&display_layer, 0, sizeof(display_layer));
    
    
    window_init(&window, "LCAR");
    window_stack_push(&window, true /* Animated */);
    
    resource_init_current_app(&APP_RESOURCES);
    
    bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image);
    layer_init(&display_layer, GRect(43, 110, 82, 35));
    display_layer.update_proc = &display_layer_update_callback;
    
    layer_add_child(&window.layer, &background_image.layer.layer);
    
    
    layer_add_child(&window.layer, &background_image.layer.layer);
    layer_add_child(&window.layer,&display_layer);
    
 
    
    
    // Avoids a blank screen on watch start.
    PblTm tick_time;
    
    get_time(&tick_time);
    update_display(&tick_time);
    
}
Esempio n. 12
0
void handle_init(AppContextRef ctx) {
  (void)ctx;

  window_init(&window, "Bar Graph");
  window_stack_push(&window, true /* Animated */);

  resource_init_current_app(&APP_RESOURCES);

  bmp_init_container(RESOURCE_ID_IMAGE_FACE, &faceImage);
  layer_add_child(&window.layer, &faceImage.layer.layer);

  layer_init(&hourLayer, window.layer.frame);
  hourLayer.update_proc = &update_hour;
  layer_add_child(&window.layer, &hourLayer);

  layer_init(&minLayer, window.layer.frame);
  minLayer.update_proc = &update_minute;
  layer_add_child(&window.layer, &minLayer);

  text_layer_init(&dateText, GRect(0,138,144,30));
  text_layer_set_text_color(&dateText, GColorWhite);
  text_layer_set_background_color(&dateText, GColorClear);
  text_layer_set_text_alignment(&dateText, GTextAlignmentCenter);
  text_layer_set_font(&dateText, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_22)));
  layer_add_child(&window.layer, &dateText.layer);

  update_date();
}
Esempio n. 13
0
static void handle_init(AppContextRef ctx) {
  (void) ctx;

  window_init(&s_data.window, "Clock_Window");
  const bool animated = true;
  window_stack_push(&s_data.window, animated);

  window_set_background_color(&s_data.window, GColorBlack);
  resource_init_current_app(&APP_RESOURCES);

  //GFont gotham = fonts_get_system_font(FONT_KEY_DROID_SERIF_28_BOLD);
  GFont fontPlain = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SANSATION_LIGHT_42));
  GFont fontBold = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SANSATION_BOLD_42));

  text_layer_init(&s_data.label, GRect(0, 0, s_data.window.layer.frame.size.w, 100));
  text_layer_init(&s_data.label2, GRect(0, 37, s_data.window.layer.frame.size.w, s_data.window.layer.frame.size.h - 37));
  text_layer_set_background_color(&s_data.label, GColorClear);
  text_layer_set_background_color(&s_data.label2, GColorClear);
  text_layer_set_text_color(&s_data.label, GColorWhite);
  text_layer_set_text_color(&s_data.label2, GColorWhite);
  text_layer_set_font(&s_data.label, fontBold);
  text_layer_set_font(&s_data.label2, fontPlain);
  layer_add_child(&s_data.window.layer, &s_data.label.layer);
  layer_add_child(&s_data.window.layer, &s_data.label2.layer);

  PblTm t;
  get_time(&t);
  update_time(&t);
}
Esempio n. 14
0
//
// sets up the display
//
void handle_init(AppContextRef ctx) {
  (void)ctx;

    window_init(&window, "Simplicity");
    window_stack_push(&window, true /* Animated */);
    window_set_background_color(&window, GColorBlack);
    resource_init_current_app(&APP_RESOURCES);
    
    //
    // Load the bitmaps
    //
    bmp_init_container( RESOURCE_ID_IMAGE_PIC1, &_pic1 );
    bmp_init_container( RESOURCE_ID_IMAGE_PIC2, &_pic2 );
    bmp_init_container( RESOURCE_ID_IMAGE_PIC3, &_pic3 );

    //
    // create the bitmap layer at the back
    //
    bitmap_layer_init( &_currentPicture, GRect(0,0, 144, 168) );
    layer_add_child( &window.layer, &_currentPicture.layer );
    
    //
    // load the font we are using
    //
    GFont font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21));
    
    //
    // create the text layers
    //
    setupTextLayer( &_currentDate, &window, 2, 168-21, 144-4, 21, font );
    setupTextLayer( &_currentTime, &window, 2, 168-42, 144-4, 21, font );
}
Esempio n. 15
0
void handle_init(AppContextRef ctx) {
    (void)ctx;

    window_init(&window, "Hebrew Text");
    window_stack_push(&window, true /* Animated */);

    window_set_background_color(&window, GColorBlack);

    // If you neglect to call this, all `resource_get_handle()` requests
    // will return NULL.
    resource_init_current_app(&RESOURCES);

    font42 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SIMPLE_42));
    font36 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SIMPLE_36));
    font28 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SIMPLE_28));


    text_layer_init(&timeLayer, GRect(0, 0, window.layer.frame.size.w, window.layer.frame.size.h));
    text_layer_set_text_color(&timeLayer, GColorWhite);
    text_layer_set_text_alignment(&timeLayer, GTextAlignmentRight);
    text_layer_set_background_color(&timeLayer, GColorClear);

    handle_minute_tick(ctx, NULL);

    layer_add_child(&window.layer, &timeLayer.layer);
}
Esempio n. 16
0
static void
handle_init(
	AppContextRef ctx
)
{
	(void) ctx;

	window_init(&window, "Main");
	window_stack_push(&window, true);
	window_set_background_color(&window, GColorBlack);

	resource_init_current_app(&APP_RESOURCES);

	int y = 15;
	int h = 30;

	font_thin_28 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_28));
	font_thick_30 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_BLACK_30));
	font_thin_12 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_12));
	font_thin_18 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_18));
	font_thin_22 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_22));
	font_thin_16 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_16));
	font_thick_18 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_BLACK_18));
	font_thick_24 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_BLACK_24));
	// Stack top to bottom.  Note that the hour can take up
	// two rows at midnight.
	text_layer(&kpi3_word, GRect(4, y + 4.2*h, 144, h+8), font_thin_18);
	text_layer(&kpi2_word, GRect(4, y + 3.5*h, 144, h+8), font_thin_18);
	text_layer(&kpi1_word, GRect(4, y + 2.8*h, 144, h+8), font_thin_18);
	text_layer(&ampm_word, GRect(4, y + 2.1*h, 144, h+8), font_thin_18);
	text_layer(&hour_word, GRect(4, y + 1.4*h, 144, 2*h+8), font_thick_18);
	text_layer(&rel_word, GRect(4, y + 0.7*h, 144, h+8), font_thin_18);
	text_layer(&min_word, GRect(4, y + 0*h, 144, h+8), font_thin_18);

}
Esempio n. 17
0
void handle_init(AppContextRef ctx) {
  (void) ctx;

  window_init(&window, "Totoro");
  window_stack_push(&window, true);

  resource_init_current_app(&APP_RESOURCES);

  // Set up a layer for the static watch face background
  bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image_container);
  layer_add_child(&window.layer, &background_image_container.layer.layer);


  // Date
  // Initialises the date and sets the text, font and background colour
  text_layer_init(&text_date_layer, window.layer.frame);
  text_layer_set_text_color(&text_date_layer, GColorBlack);
  text_layer_set_background_color(&text_date_layer, GColorClear);
  layer_set_frame(&text_date_layer.layer, GRect(69, 150, 80, 15));

  text_layer_set_font(&text_date_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_GOTHIC_REGULAR_12)));
  layer_add_child(&window.layer, &text_date_layer.layer);

  // Time
  // Initialises the time and sets the text, font and background colour
  text_layer_init(&text_time_layer, window.layer.frame);
  text_layer_set_text_color(&text_time_layer, GColorBlack);
  text_layer_set_background_color(&text_time_layer, GColorClear);
  layer_set_frame(&text_time_layer.layer, GRect(0, 0, 144, 44));

  text_layer_set_font(&text_time_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_GOTHIC_REGULAR_36)));
  text_layer_set_text_alignment(&text_time_layer, GTextAlignmentCenter);
  layer_add_child(&window.layer, &text_time_layer.layer);

}
Esempio n. 18
0
void handle_init(AppContextRef ctx) {
  (void)ctx;

  window_init(&window, "Modern Watch");
  window_stack_push(&window, true /* Animated */);
  resource_init_current_app(&APP_RESOURCES);

#if DISPLAY_DATE_ANALOG
  bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND_DATEBOX, &background_image_container);
#elif INVERTED
  bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND_INVERTED, &background_image_container);
#else
  bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image_container);
#endif
  layer_add_child(&window.layer, &background_image_container.layer.layer);

#if DISPLAY_DATE_ANALOG
  date_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ORBITRON_MEDIUM_12));
  text_layer_init(&date_layer, GRect(116, 77, 20, 20));
#else
  date_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_DIGITALDREAM_NARROW_12));
  text_layer_init(&date_layer, GRect(27, 110, 90, 30));
#endif
#if DISPLAY_DATE_ANALOG
  text_layer_set_text_color(&date_layer, GColorBlack);
#elif INVERTED
  text_layer_set_text_color(&date_layer, GColorBlack);
#else
  text_layer_set_text_color(&date_layer, GColorWhite);
#endif
  text_layer_set_text_alignment(&date_layer, GTextAlignmentCenter);
  text_layer_set_background_color(&date_layer, GColorClear);
  text_layer_set_font(&date_layer, date_font);
  layer_add_child(&window.layer, &date_layer.layer);

  draw_date();

  layer_init(&hour_display_layer, window.layer.frame);
  hour_display_layer.update_proc = &hour_display_layer_update_callback;
  layer_add_child(&window.layer, &hour_display_layer);

  gpath_init(&hour_hand_path, &HOUR_HAND_PATH_POINTS);
  gpath_move_to(&hour_hand_path, grect_center_point(&hour_display_layer.frame));

  layer_init(&minute_display_layer, window.layer.frame);
  minute_display_layer.update_proc = &minute_display_layer_update_callback;
  layer_add_child(&window.layer, &minute_display_layer);

  gpath_init(&minute_hand_path, &MINUTE_HAND_PATH_POINTS);
  gpath_move_to(&minute_hand_path, grect_center_point(&minute_display_layer.frame));

  layer_init(&center_display_layer, window.layer.frame);
  center_display_layer.update_proc = &center_display_layer_update_callback;
  layer_add_child(&window.layer, &center_display_layer);
#if DISPLAY_SECONDS
  layer_init(&second_display_layer, window.layer.frame);
  second_display_layer.update_proc = &second_display_layer_update_callback;
  layer_add_child(&window.layer, &second_display_layer);
#endif
}
void handle_init(AppContextRef ctx) {
	resource_init_current_app(&HOUSECONTROL);
	
	window_init(&homeWindow, "Group Selection");
	WindowHandlers handlers = {
		.appear = &handle_home_window_appear
	};
	window_set_window_handlers(&homeWindow, handlers);
	window_stack_push(&homeWindow, true /* Animated */);
	
	window_init(&groupWindow, "Device Selection");
	WindowHandlers handlers2 = {
		.appear = &handle_group_window_appear
	};
	window_set_window_handlers(&groupWindow, handlers2);
	
	window_init(&deviceWindow, "Device");
	WindowHandlers handlers3 = {
		.appear = &handle_device_window_appear
	};
	window_set_window_handlers(&deviceWindow, handlers3);
	
	//HOME LAYER
	GRect bounds = homeWindow.layer.bounds;
	menu_layer_init(&homeLayer, bounds);
	
	menu_layer_set_callbacks(&homeLayer, NULL, (MenuLayerCallbacks){
		.get_num_rows		= menu_home_get_num_rows,
		.draw_row 			= menu_home_draw_row,
		.select_click 		= menu_home_select_click
	});
Esempio n. 20
0
void handle_init(AppContextRef ctx) {

  window_init(&window, "Simplicity");
  window_stack_push(&window, true /* Animated */);
  window_set_background_color(&window, GColorBlack);

  resource_init_current_app(&APP_RESOURCES);


  text_layer_init(&text_date_layer, window.layer.frame);
  text_layer_set_text_color(&text_date_layer, GColorWhite);
  text_layer_set_background_color(&text_date_layer, GColorClear);
  layer_set_frame(&text_date_layer.layer, GRect(8, 28, 144-8, 40));
  text_layer_set_font(&text_date_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TEST_21)));
  layer_add_child(&window.layer, &text_date_layer.layer);


  text_layer_init(&text_time_layer, window.layer.frame);
  text_layer_set_text_color(&text_time_layer, GColorWhite);
  text_layer_set_background_color(&text_time_layer, GColorClear);
  layer_set_frame(&text_time_layer.layer, GRect(1, 62, 144-2, 168-62));
  text_layer_set_font(&text_time_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TEST_48)));
  layer_add_child(&window.layer, &text_time_layer.layer);


  layer_init(&line_layer, window.layer.frame);
  line_layer.update_proc = &line_layer_update_callback;
  layer_add_child(&window.layer, &line_layer);


  // TODO: Update display here to avoid blank display on launch?
}
Esempio n. 21
0
void handle_init(AppContextRef ctx) {
    (void)ctx;

    window_init(&window, "Demo");
    window_stack_push(&window, true /* Animated */);

    resource_init_current_app(&FUZZYZEIT_RESOURCES);

    custom_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_MPC_32));
    custom_font2 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_MPBC_32));

    window_set_background_color(&window, GColorBlack);
    graphics_context_set_text_color(ctx, GColorWhite);

    text_layer_init(&min_layer, GRect(4, 35, 144 /* width */, 50 /* height */));
    text_layer_set_text_color(&min_layer, GColorWhite);
    text_layer_set_text(&min_layer, "");
    text_layer_set_font(&min_layer, custom_font);
    text_layer_set_background_color(&min_layer, GColorClear);

    layer_add_child(&window.layer, &min_layer.layer);
    layer_mark_dirty(&min_layer.layer);

    text_layer_init(&hour_layer, GRect(4, 80, 144 /* width */, 50 /* height */));
    text_layer_set_text_color(&hour_layer, GColorWhite);
    text_layer_set_text(&hour_layer, "");
    text_layer_set_font(&hour_layer, custom_font2);
    text_layer_set_background_color(&hour_layer, GColorClear);

    layer_add_child(&window.layer, &hour_layer.layer);
    layer_mark_dirty(&hour_layer.layer);

    update_layer(ctx);

}
Esempio n. 22
0
static void
handle_init( AppContextRef ctx)
{
	(void)ctx;

	// Fonts will NOT work without this!
	resource_init_current_app(&APP_RESOURCES);
	
	window_init(&window, "Hello, Pebble");
	window_stack_push(&window, true /* Animated */);
		
	// Create a container for the static background image (recovery symbol)
	bmp_init_container(RESOURCE_ID_IMAGE_FANCY_FRAME, &bg_img);
	// place image
	bg_img.layer.layer.frame.origin.x = 0;
	bg_img.layer.layer.frame.origin.y = 0;

	layer_add_child(&window.layer, &bg_img.layer.layer);
	// draw the image
	layer_mark_dirty(&bg_img.layer.layer);
	
	// Tell it what font to use
	myfont = fonts_load_custom_font(
		resource_get_handle(RESOURCE_ID_FONT_QUMPELLKA_20));

	// Add TIME
	// GRect takes x,y,w,h
	text_layer_init(&text_time, GRect(30,70,80,30));
	text_layer_set_font(&text_time, myfont);
	text_layer_set_text(&text_time, "");
	text_layer_set_background_color(&text_time, GColorClear);
	text_layer_set_text_color(&text_time, GColorWhite);
	text_layer_set_text_alignment(&text_time, GTextAlignmentCenter);
	layer_add_child(&window.layer, &text_time.layer);
	
	/*********************** CODE FOR INCLUDING DATE ****************
	// Add DAY OF THE MONTH
	// GRect takes x,y,w,h
	text_layer_init(&text_day, GRect(75,118,73,58));
	text_layer_set_font(&text_day, myfont);
	text_layer_set_text(&text_day, "");
	text_layer_set_background_color(&text_day, GColorClear);
	text_layer_set_text_color(&text_day, GColorBlack);
	layer_add_child(&window.layer, &text_day.layer);
	
	// Change fonts so the month won't be too big'
	myfont = fonts_load_custom_font(
		resource_get_handle(RESOURCE_ID_FONT_QARMIC_SANS_18));
	
	// Add MONTH
	// GRect takes x,y,w,h
	text_layer_init(&text_month, GRect(75,144,73,58));
	text_layer_set_font(&text_month, myfont);
	text_layer_set_text(&text_month, "");
	text_layer_set_background_color(&text_month, GColorClear);
	text_layer_set_text_color(&text_month, GColorBlack);
	layer_add_child(&window.layer, &text_month.layer);
	*****************************************************************/
}
Esempio n. 23
0
void handle_init(AppContextRef ctx) {
    (void)ctx;

    window_init(&window, "Watchface");
    window_stack_push(&window, true /* Animated */);
    window_set_background_color(&window, GColorBlack);
        
    PblTm t;
    get_time(&t);
    setPhase(daysSinceNewMoon(t.tm_year+1900,t.tm_yday,t.tm_hour));
    
    curHour=t.tm_hour;
    curMin=t.tm_min;
    curSec=t.tm_sec;
    
    if(showDetailedMoonGraphic){
        
        resource_init_current_app(&LUNARCLOCK_IMAGE_RESOURCES);
        bmp_init_container(RESOURCE_ID_IMAGE_MOON, &moonimage_container);
        layer_add_child(&window.layer, &moonimage_container.layer.layer);
    }else{
        layer_init(&moon_layer, window.layer.frame);
        moon_layer.update_proc = &moon_layer_update_callback;
        layer_add_child(&window.layer, &moon_layer);
    }
    layer_init(&shadow_layer, window.layer.frame);
    shadow_layer.update_proc = &shadow_layer_update_callback;
    layer_add_child(&window.layer, &shadow_layer);
    
    layer_init(&phase_layer, window.layer.frame);
    phase_layer.update_proc = &phase_layer_update_callback;
    layer_add_child(&window.layer, &phase_layer);
    
    if(showHours){
        layer_init(&hour_layer, window.layer.frame);
        hour_layer.update_proc = &hour_layer_update_callback;
        layer_add_child(&window.layer, &hour_layer);
        
        gpath_init(&hour_hand, &hour_hand_info);
        gpath_move_to(&hour_hand, GPoint(centerx, centery));
        
    }
    if(showMinutes){
        layer_init(&minute_layer, window.layer.frame);
        minute_layer.update_proc = &minute_layer_update_callback;
        layer_add_child(&window.layer, &minute_layer);
        
        gpath_init(&minute_hand, &minute_hand_info);
        gpath_move_to(&minute_hand, GPoint(centerx, centery));
    }
    if(showSeconds){
        layer_init(&second_layer, window.layer.frame);
        second_layer.update_proc = &second_layer_update_callback;
        layer_add_child(&window.layer, &second_layer);
    }
    layer_init(&top_layer, window.layer.frame);
    top_layer.update_proc = &top_layer_update_callback;
    layer_add_child(&window.layer, &top_layer);
}
Esempio n. 24
0
void handle_init(AppContextRef ctx) {
  (void)ctx;
  window_init(&window, "PowerSave");
  window_stack_push(&window, false /* NOT Animated */);
  resource_init_current_app(&APP_RESOURCES);
  bmp_init_container(RESOURCE_ID_IMAGE, &bmp_cont);
  layer_add_child(&window.layer, &bmp_cont.layer.layer);
}
Esempio n. 25
0
void handle_init(AppContextRef ctx) {
    g_app_context = ctx;
    window_init(&window, "iPod");
    window_stack_push(&window, true /* Animated */);
    main_menu_init(&window);
    init_library_menus();
    ipod_state_init();
    resource_init_current_app(&APP_RESOURCES);
}
Esempio n. 26
0
void handle_init(AppContextRef ctx) {
    (void)ctx;

    window_init(&window, "Brown Watch");
    window_stack_push(&window, true /* Animated */);

    resource_init_current_app(&APP_RESOURCES);
#if DISPLAY_DATE_SHORT
    bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND_BOX, &background_image_container);
#else
    bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image_container);
#endif
    layer_add_child(&window.layer, &background_image_container.layer.layer);


#if DISPLAY_DATE_SHORT || DISPLAY_DATE_LONG
    date_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_OPENSANS_REGULAR_14));
    text_layer_init(&date_layer, GRect(27, 110, 90, 30));
    text_layer_set_text_alignment(&date_layer, GTextAlignmentCenter);
    text_layer_set_text_color(&date_layer, GColorWhite);
    text_layer_set_background_color(&date_layer, GColorClear);
    text_layer_set_font(&date_layer, date_font);
    layer_add_child(&window.layer, &date_layer.layer);
    draw_date();
#endif

    layer_init(&hour_display_layer, window.layer.frame);
    hour_display_layer.update_proc = &hour_display_layer_update_callback;
    layer_add_child(&window.layer, &hour_display_layer);

    gpath_init(&hour_hand_outline_path, &HOUR_HAND_OUTLINE_PATH_POINTS);
    gpath_move_to(&hour_hand_outline_path, grect_center_point(&hour_display_layer.frame));
    gpath_init(&hour_hand_path, &HOUR_HAND_PATH_POINTS);
    gpath_move_to(&hour_hand_path, grect_center_point(&hour_display_layer.frame));

    layer_init(&minute_display_layer, window.layer.frame);
    minute_display_layer.update_proc = &minute_display_layer_update_callback;
    layer_add_child(&window.layer, &minute_display_layer);

    gpath_init(&minute_hand_outline_path, &MINUTE_HAND_OUTLINE_PATH_POINTS);
    gpath_move_to(&minute_hand_outline_path, grect_center_point(&minute_display_layer.frame));
    gpath_init(&minute_hand_path, &MINUTE_HAND_PATH_POINTS);
    gpath_move_to(&minute_hand_path, grect_center_point(&minute_display_layer.frame));

    layer_init(&center_display_layer, window.layer.frame);
    center_display_layer.update_proc = &center_display_layer_update_callback;
    layer_add_child(&window.layer, &center_display_layer);

#if DISPLAY_SECONDS
    layer_init(&second_display_layer, window.layer.frame);
    second_display_layer.update_proc = &second_display_layer_update_callback;
    layer_add_child(&window.layer, &second_display_layer);
#endif
}
Esempio n. 27
0
void handle_init(AppContextRef ctx) {
  (void)ctx;

  window_init(&window, "SunClock");
  window_stack_push(&window, true /* Animated */);
  window_set_background_color(&window, GColorWhite);

  resource_init_current_app(&APP_RESOURCES);

  fontBig = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SUNCLOCK_30));
  fontSmall = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SUNCLOCK_16));
  fontMoonPhases = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_MOON_PHASES_30));

  layer_init(&graphics_sun_layer, window.layer.frame);
  graphics_sun_layer.update_proc = &graphics_sun_layer_update_callback;
  layer_add_child(&window.layer, &graphics_sun_layer);

  rotbmp_pair_init_container(RESOURCE_ID_IMAGE_WATCHFACE_WHITE, RESOURCE_ID_IMAGE_WATCHFACE_BLACK, &watchface_container);
  layer_add_child(&graphics_sun_layer, &watchface_container.layer.layer);
  watchface_container.layer.layer.frame.origin.x = (144/2) - (watchface_container.layer.layer.frame.size.w/2);
  watchface_container.layer.layer.frame.origin.y = (168/2) - (watchface_container.layer.layer.frame.size.h/2);

  rotbmp_pair_init_container(RESOURCE_ID_IMAGE_HOUR_WHITE, RESOURCE_ID_IMAGE_HOUR_BLACK, &bitmap_hour_container);
  rotbmp_pair_layer_set_src_ic(&bitmap_hour_container.layer, GPoint(6,56));
  layer_add_child(&window.layer, &bitmap_hour_container.layer.layer);
  PblTm t;
  get_time(&t);
  rotbmp_pair_layer_set_angle(&bitmap_hour_container.layer, TRIG_MAX_ANGLE * get24HourAngle(t.tm_hour, t.tm_min));
  bitmap_hour_container.layer.layer.frame.origin.x = (144/2) - (bitmap_hour_container.layer.layer.frame.size.w/2);
  bitmap_hour_container.layer.layer.frame.origin.y = (168/2) - (bitmap_hour_container.layer.layer.frame.size.h/2);

  text_layer_init(&text_time_layer, window.layer.frame);
  text_layer_set_text_color(&text_time_layer, GColorBlack);
  text_layer_set_background_color(&text_time_layer, GColorClear);
  layer_set_frame(&text_time_layer.layer, GRect(0, 35, 144, 30));
  text_layer_set_font(&text_time_layer, fontBig);
  layer_add_child(&window.layer, &text_time_layer.layer);

  text_layer_init(&text_sunrise_layer, window.layer.frame);
  text_layer_set_text_color(&text_sunrise_layer, GColorWhite);
  text_layer_set_background_color(&text_sunrise_layer, GColorClear);
  layer_set_frame(&text_sunrise_layer.layer, GRect(0, 150, 144, 18));
  text_layer_set_font(&text_sunrise_layer, fontSmall);
  layer_add_child(&window.layer, &text_sunrise_layer.layer);

  text_layer_init(&text_sunset_layer, window.layer.frame);
  text_layer_set_text_color(&text_sunset_layer, GColorWhite);
  text_layer_set_background_color(&text_sunset_layer, GColorClear);
  layer_set_frame(&text_sunset_layer.layer, GRect(0, 150, 144, 18));
  text_layer_set_font(&text_sunset_layer, fontSmall);
  layer_add_child(&window.layer, &text_sunset_layer.layer); 

  updateDayAndNightInfo();
}
Esempio n. 28
0
void handle_init(AppContextRef ctx) {
	(void)ctx;

	window_init(&window, "VeryPlain");
	window_stack_push(&window, true);
	window_set_background_color(&window, GColorBlack);

	resource_init_current_app(&APP_RESOURCES);

	initLayerPathAndCenter(&hour_display_layer, &hour_hand_path, &HOUR_HAND_PATH_POINTS, &hour_display_layer_update_callback);
	initLayerPathAndCenter(&minute_display_layer, &minute_hand_path, &MINUTE_HAND_PATH_POINTS, &minute_display_layer_update_callback);
	//initLayerPathAndCenter(&second_display_layer, &second_hand_path, &SECOND_HAND_PATH_POINTS, &second_display_layer_update_callback);
}
Esempio n. 29
0
void handle_init(AppContextRef ctx) {
  (void)ctx;

  window_init(&window, "Triforce");
  window_stack_push(&window, true /*animated */);
  window_set_background_color(&window,GColorBlack);
    
  // Display the black and white image with transparency.
  resource_init_current_app(&APP_RESOURCES);

  rotbmp_pair_init_container(RESOURCE_ID_IMAGE_TRIFORCE_WHITE, RESOURCE_ID_IMAGE_TRIFORCE_BLACK, &triforce);
  triforce.layer.layer.frame.origin.x = 5;
  triforce.layer.layer.frame.origin.y = -10;
  
  layer_add_child(&window.layer, &triforce.layer.layer);
  
  rotbmp_pair_init_container(RESOURCE_ID_IMAGE_DOTS_WHITE, RESOURCE_ID_IMAGE_DOTS_BLACK, &dots);
  dots.layer.layer.frame.origin.x = 5;
  dots.layer.layer.frame.origin.y = -10;
  
  layer_add_child(&window.layer, &dots.layer.layer);
  	
  //Initializes the timeLayer  
  text_layer_init(&timeLayer, GRect(0, 168-42, 144 /* width */, 42 /* height */));
  text_layer_set_text_alignment(&timeLayer, GTextAlignmentCenter);
  text_layer_set_text_color(&timeLayer, GColorWhite);
  layer_set_frame(&timeLayer.layer, GRect(0, 100, 144, 168-100));
  text_layer_set_background_color(&timeLayer, GColorClear);
  text_layer_set_font(&timeLayer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TRIFORCE_30)));

  layer_add_child(&window.layer, &timeLayer.layer);
  
  //Initializes the Date layer
  text_layer_init(&text_date_layer, window.layer.frame);
  text_layer_set_text_color(&text_date_layer, GColorWhite);
  text_layer_set_background_color(&text_date_layer, GColorClear);
  layer_set_frame(&text_date_layer.layer, GRect(40, 140, 144-40, 168-140));
  text_layer_set_font(&text_date_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TRIFORCE_20)));
  layer_add_child(&window.layer, &text_date_layer.layer);
  
  //Initializes the AM/PM layer
  text_layer_init(&AMPM, window.layer.frame);
  text_layer_set_text_color(&AMPM, GColorWhite);
  text_layer_set_background_color(&AMPM, GColorClear);
  layer_set_frame(&AMPM.layer, GRect(110, 107, 144-110, 168-107));
  layer_add_child(&window.layer, &AMPM.layer);

  update_time_display();

}
void handle_init(AppContextRef ctx) {

  window_init(&window, "Simple Chinese");
  window_stack_push(&window, true /* Animated */);
  window_set_background_color(&window, BACKGROUNDCOLOR);

  resource_init_current_app(&APP_RESOURCES);

  layer_init(&line_layer, window.layer.frame);
  line_layer.update_proc = &line_layer_update_callback;
  layer_add_child(&window.layer, &line_layer);

  DTL_init(&time_layer, &window.layer, time_GRECT, time_FONT, _time_upd, _time_upd_cri);

  DTL_init(&date_layer, &window.layer, date_GRECT, date_FONT, _date_upd, _date_upd_cri);
  
  if(!clock_is_24h_style())
  	DTL_init(&period_layer, &window.layer, period_GRECT, period_FONT, _period_upd, _period_upd_cri);

  #if INCLUDE_CCD
  DTL_init(&cdate_layer, &window.layer, cdate_GRECT, cdate_FONT, _cdate_upd, _cdate_upd_cri);
  #endif

  #if INCLUDE_SEC
  DTL_init(&sec_layer, &window.layer, sec_GRECT, sec_FONT, _sec_upd, _sec_upd_cri);
  #endif

  DTL_init(&weather_layer, &window.layer, weather_GRECT, weather_FONT, _weather_upd, _weather_upd_cri);
  DTL_set_alignment(&weather_layer, GTextAlignmentRight);

  #if DEBUG
  DTL_init(&debug_layer, &window.layer, debug_GRECT, debug_FONT, NULL, NULL);
  #endif

  DTL_init(&info_layer, &window.layer, info_GRECT, info_FONT, NULL, NULL);
  DTL_set_alignment(&info_layer, GTextAlignmentRight);

  srand(time(NULL));
  int32_t HTTP_APP_ID = RAND_MAX/2 - rand(); 
  
  http_set_app_id(HTTP_APP_ID);
  HTTPCallbacks httpcallbacks = {
    .success = handle_success,
    .failure = handle_failed,
    .location = handle_location,
    .reconnect = handle_reconnect
  };
  http_register_callbacks(httpcallbacks, ctx);

}