Exemple #1
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);

}
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);


}
void handle_init(AppContextRef ctx) {
  (void)ctx;

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

  resource_init_current_app(&APP_RESOURCES);

	first_run = "true";
	hours_word.old_text = hours_word.text;

  bmp_init_container(RESOURCE_ID_IMAGE_HOUR_BG, &background_image_container);
  layer_add_child(&window.layer, &background_image_container.layer.layer);


//	font_minutes = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ARIAL_BLACK_50));
//	text_layer(&font_minutes_word, GRect(0, 40, 143, 100), font_minutes);
/*  add to resource_map.json:
  {
				"type":"font",
				"defName":"FONT_ARIAL_BLACK_50",
				"file":"fonts/Arial-Black.ttf"
  }
*/

// much less space needed because font is built in
//	font_minutes = fonts_get_system_font(FONT_KEY_GOTHAM_42_MEDIUM_NUMBERS);
	font_minutes = fonts_get_system_font(FONT_KEY_GOTHAM_42_BOLD);
	text_layer(&font_minutes_word, GRect(0, 58, 143, 50), font_minutes);

	text_layer_set_text_alignment(&font_minutes_word.layer, GTextAlignmentCenter);
	
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_1, &hour_image_container_1);
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_2, &hour_image_container_2);
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_3, &hour_image_container_3);
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_4, &hour_image_container_4);
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_5, &hour_image_container_5);
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_6, &hour_image_container_6);
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_7, &hour_image_container_7);
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_8, &hour_image_container_8);
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_9, &hour_image_container_9);
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_10, &hour_image_container_10);
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_11, &hour_image_container_11);
	rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_12, &hour_image_container_12);

	//GCompOpAssign, GCompOpAssignInverted, GCompOpOr, GCompOpAnd, GCompOpClear
	GCompOp mode = GCompOpAssign;
  hour_image_container_1.layer.compositing_mode = mode;
  hour_image_container_2.layer.compositing_mode = mode;
  hour_image_container_3.layer.compositing_mode = mode;
  hour_image_container_4.layer.compositing_mode = mode;
  hour_image_container_5.layer.compositing_mode = mode;
  hour_image_container_6.layer.compositing_mode = mode;
  hour_image_container_7.layer.compositing_mode = mode;
  hour_image_container_8.layer.compositing_mode = mode;
  hour_image_container_9.layer.compositing_mode = mode;
  hour_image_container_10.layer.compositing_mode = mode;
  hour_image_container_11.layer.compositing_mode = mode;
  hour_image_container_12.layer.compositing_mode = mode;

	//GPoint pointxy = GPoint(-73, -75);
	GPoint pointxy = GPoint(14, 70);
  rot_bitmap_set_src_ic(&hour_image_container_1.layer, pointxy);
  rot_bitmap_set_src_ic(&hour_image_container_2.layer, pointxy);
  rot_bitmap_set_src_ic(&hour_image_container_3.layer, pointxy);
  rot_bitmap_set_src_ic(&hour_image_container_4.layer, pointxy);
  rot_bitmap_set_src_ic(&hour_image_container_5.layer, pointxy);
  rot_bitmap_set_src_ic(&hour_image_container_6.layer, pointxy);
  rot_bitmap_set_src_ic(&hour_image_container_7.layer, pointxy);
  rot_bitmap_set_src_ic(&hour_image_container_8.layer, pointxy);
  rot_bitmap_set_src_ic(&hour_image_container_9.layer, pointxy);
  rot_bitmap_set_src_ic(&hour_image_container_10.layer, pointxy);
  rot_bitmap_set_src_ic(&hour_image_container_11.layer, pointxy);
  rot_bitmap_set_src_ic(&hour_image_container_12.layer, pointxy);

  layer_add_child(&window.layer, &hour_image_container_1.layer.layer);
  layer_add_child(&window.layer, &hour_image_container_2.layer.layer);
  layer_add_child(&window.layer, &hour_image_container_3.layer.layer);
  layer_add_child(&window.layer, &hour_image_container_4.layer.layer);
  layer_add_child(&window.layer, &hour_image_container_5.layer.layer);
  layer_add_child(&window.layer, &hour_image_container_6.layer.layer);
  layer_add_child(&window.layer, &hour_image_container_7.layer.layer);
  layer_add_child(&window.layer, &hour_image_container_8.layer.layer);
  layer_add_child(&window.layer, &hour_image_container_9.layer.layer);
  layer_add_child(&window.layer, &hour_image_container_10.layer.layer);
  layer_add_child(&window.layer, &hour_image_container_11.layer.layer);
  layer_add_child(&window.layer, &hour_image_container_12.layer.layer);


  update_hand_positions();


}