Beispiel #1
0
static void main_window_load(Window *window) {
  
  GRect bounds = window_get_bounds(window);

  s_color_layer_1 = layer_create(GRect(0,0,144,56));
  s_color_layer_2 = layer_create(GRect(0,56,144,56));
  s_color_layer_3 = layer_create(GRect(0,112,144,56));

  s_color_text_1 = text_layer_create(GRect(0,0,144,56));
  s_color_text_2 = text_layer_create(GRect(0,0,144,56));
  s_color_text_3 = text_layer_create(GRect(0,0,144,56));
  
  text_layer_set_colors(s_color_text_1, GColorWhite, (GColor)gcolor[color1]);
  text_layer_set_colors(s_color_text_2, GColorWhite, (GColor)gcolor[color2]);
  text_layer_set_colors(s_color_text_3, GColorWhite, (GColor)gcolor[color3]);

  text_layer_set_text(s_color_text_1, colorname[color1]);
  text_layer_set_text(s_color_text_2, colorname[color2]);
  text_layer_set_text(s_color_text_3, colorname[color3]);

  text_layer_set_text_alignment(s_color_text_1, GTextAlignmentCenter);
  text_layer_set_text_alignment(s_color_text_2, GTextAlignmentCenter);
  text_layer_set_text_alignment(s_color_text_3, GTextAlignmentCenter);

  layer_add_to_window(s_color_layer_1, window);
  layer_add_to_window(s_color_layer_2, window);
  layer_add_to_window(s_color_layer_3, window);

  text_layer_add_to_layer(s_color_text_1, s_color_layer_1);
  text_layer_add_to_layer(s_color_text_2, s_color_layer_2);
  text_layer_add_to_layer(s_color_text_3, s_color_layer_3);
}
Beispiel #2
0
static void window_load(Window *window) {
  
  GRect bounds = window_get_bounds(window);
  
  s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_POKEMON_REG_12));
  s_reg_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_POKEMON_BOLD_10));
  
  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_BACKGROUND);
  s_poke1_bitmap = gbitmap_create_with_resource(RESOURCE_ID_POKE1);
  s_poke2_bitmap = gbitmap_create_with_resource(RESOURCE_ID_POKE2);

  s_background_layer = bitmap_layer_create(bounds);
  s_poke1_layer = bitmap_layer_create(GRect(0, 56, 55, 56));
  s_poke2_layer = bitmap_layer_create(GRect(88, 3, 56, 56));
  s_time_layer = layer_create(bounds);
  s_battery_layer = layer_create(GRect(82,87,144,168));
  s_bluetooth_layer = layer_create(GRect( 22, 22, 50,4));
  s_enemy_layer = layer_create(bounds);
  s_time_label = text_layer_create(GRect(7, 5, 130, 95));
  s_day_label = text_layer_create(GRect(10, 73, 130, 95));
  s_date_label = text_layer_create(GRect(10, 93, 130, 95));
  
  text_layer_set_text(s_time_label, "Time"); 
  text_layer_set_text(s_day_label, "Day"); 
  text_layer_set_text(s_date_label, "Date");
  
  layer_set_update_proc(s_bluetooth_layer, bluetooth_color_proc);
  layer_set_update_proc(s_battery_layer, update_battery);
  layer_set_update_proc(s_time_layer, date_update_proc);
  bitmap_layer_set_bitmap(s_background_layer, s_background_bitmap);
  bitmap_layer_set_bitmap(s_poke1_layer, s_poke1_bitmap);
  bitmap_layer_set_bitmap(s_poke2_layer, s_poke2_bitmap);
  
  text_layer_set_colors(s_time_label, GColorBlack, GColorClear);
  text_layer_set_colors(s_day_label, GColorBlack, GColorClear);
  text_layer_set_colors(s_date_label, GColorBlack, GColorClear);
  
  text_layer_set_font(s_time_label, s_time_font); 
  text_layer_set_font(s_date_label, s_reg_font);
  text_layer_set_font(s_day_label, s_reg_font);
  
  text_layer_set_text_alignment(s_time_label, GTextAlignmentLeft);
  text_layer_set_text_alignment(s_date_label, GTextAlignmentRight);
  text_layer_set_text_alignment(s_day_label, GTextAlignmentRight);
  
  bitmap_layer_add_to_window(s_background_layer, window);
  bitmap_layer_add_to_window(s_poke1_layer, window);
  layer_add_to_window(s_battery_layer, window);
  layer_add_to_window(s_time_layer, window);
  layer_add_to_window(s_enemy_layer, window);
  layer_add_to_layer(s_bluetooth_layer, s_enemy_layer);
  bitmap_layer_add_to_layer(s_poke2_layer, s_enemy_layer);
  text_layer_add_to_layer(s_time_label, s_time_layer);
  text_layer_add_to_layer(s_date_label, s_time_layer);
  text_layer_add_to_layer(s_day_label, s_time_layer);
  
  update_time();
}
void win_add_duration_init(void) {
  window = window_create();

  layer = layer_create_fullscreen(window);
  layer_set_update_proc(layer, layer_update);
  layer_add_to_window(layer, window);

  layer_action_bar = action_bar_layer_create();
  action_bar_layer_add_to_window(layer_action_bar, window);
  action_bar_layer_set_click_config_provider(layer_action_bar, layer_action_bar_click_config_provider);
  action_bar_layer_set_icon(layer_action_bar, BUTTON_ID_UP, bitmaps_get_bitmap(RESOURCE_ID_ACTION_INC));
  action_bar_layer_set_icon(layer_action_bar, BUTTON_ID_DOWN, bitmaps_get_bitmap(RESOURCE_ID_ACTION_DEC));
  action_bar_layer_set_icon(layer_action_bar, BUTTON_ID_SELECT, bitmaps_get_bitmap(RESOURCE_ID_ACTION_OK));

  font_duration = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_AUDI_70_BOLD));
}
Beispiel #4
0
static void main_window_load(Window *window) {
	
	s_white_effect_offset.offset_x = 2;
	s_white_effect_offset.offset_y = 2;
	s_white_effect_offset.orig_color = GColorWhite;
	s_white_effect_offset.offset_color = GColorBlack;
	
	s_yellow_effect_offset.offset_x = 2;
	s_yellow_effect_offset.offset_y = 2;
	s_yellow_effect_offset.orig_color = GColorYellow;
	s_yellow_effect_offset.offset_color = GColorBlack;
	
	GRect bounds = window_get_bounds(window);
	
	window_set_background_color(window, GColorBlack);
	
	s_time_font = fonts_load_resource_font(RESOURCE_ID_GASLIGHT_30);
	s_large_font = fonts_load_resource_font(RESOURCE_ID_GASLIGHT_40);
	s_small_font = fonts_load_resource_font(RESOURCE_ID_VIPNAGOR_12);
	
	s_effect_layer = effect_layer_create(bounds);
	
	s_blue_layer = layer_create(GRect(0,-168,144,168));
	s_yellow_layer = layer_create(GRect(144,120,144,48));
	s_time_layer = layer_create(GRect(144,0,144,168));
	s_date_layer = layer_create(GRect(-144,0,144,168));
	
	s_red_parent = layer_create(GRect(-42,0,42,168));
	
	s_red_layer = bitmap_layer_create(GRect(0,0,42,168));
	
	s_time_label = text_layer_create(GRect(0,30,129,40));
	s_month_label = text_layer_create(GRect(0,60,64,40));
	s_day_label = text_layer_create(GRect(0,60,129,40));
	s_brand_label = text_layer_create(GRect(0,5,139,40));
	
	layer_set_update_proc(s_blue_layer, update_blue);
	layer_set_update_proc(s_yellow_layer, update_yellow);
	
	s_red_bitmap = gbitmap_create_with_resource(RESOURCE_ID_SONIC);
	
	bitmap_layer_set_bitmap(s_red_layer, s_red_bitmap);
	
	bitmap_layer_set_compositing_mode(s_red_layer, GCompOpSet);
	
	text_layer_set_colors(s_time_label, GColorWhite, GColorClear);
	text_layer_set_colors(s_month_label, GColorWhite, GColorClear);
	text_layer_set_colors(s_day_label, GColorYellow, GColorClear);
	text_layer_set_colors(s_brand_label, GColorBlack, GColorClear);
	
	text_layer_set_text_alignment(s_time_label, GTextAlignmentRight);
	text_layer_set_text_alignment(s_month_label, GTextAlignmentRight);
	text_layer_set_text_alignment(s_day_label, GTextAlignmentRight);
	text_layer_set_text_alignment(s_brand_label, GTextAlignmentRight);
	
	text_layer_set_font(s_time_label, s_time_font);
	text_layer_set_font(s_month_label, s_time_font);
	text_layer_set_font(s_day_label, s_large_font);
	text_layer_set_font(s_brand_label, s_small_font);
	
	text_layer_set_text(s_brand_label, "PEBBLE TIME");
	
	layer_add_to_window(s_blue_layer, window);
	layer_add_to_window(s_yellow_layer, window);
	
	layer_add_to_window(s_red_parent, window);
	
	bitmap_layer_add_to_layer(s_red_layer, s_red_parent);
	
	layer_add_to_window(s_time_layer, window);
	layer_add_to_window(s_date_layer, window);
	
	text_layer_add_to_layer(s_time_label, s_time_layer);
	text_layer_add_to_layer(s_month_label, s_date_layer);
	text_layer_add_to_layer(s_day_label, s_date_layer);
	text_layer_add_to_layer(s_brand_label, s_yellow_layer);
	
	effect_layer_add_effect(s_effect_layer, effect_shadow, &s_white_effect_offset);
	effect_layer_add_effect(s_effect_layer, effect_shadow, &s_yellow_effect_offset);
	
	layer_add_child(s_time_layer, effect_layer_get_layer(s_effect_layer));
	layer_add_child(s_date_layer, effect_layer_get_layer(s_effect_layer));
	
	do_animation();
	update_time();
}