Exemplo n.º 1
0
void handle_init(void) {
  my_window = window_create();
  window_set_background_color(my_window, GColorBlack);
  window_stack_push(my_window, true);
  
  // creating text
  text_layer1 = text_layer_create(GRect(10, 50, 130, 80));
  text_layer_set_font(text_layer1, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
  text_layer_set_text_color(text_layer1, GColorWhite);
  text_layer_set_background_color(text_layer1, GColorClear);
  text_layer_set_text(text_layer1,"HELLO WORLD!");
  layer_add_child(window_get_root_layer(my_window), text_layer_get_layer(text_layer1));
  
  effect_layer = effect_layer_create(GRect(0, 0,144,168));
  
  // creating outline effect
  outline.orig_color = GColorWhite;
  outline.offset_color = GColorRed;
  outline.offset_x = 1;
  outline.offset_y = 1;
  effect_layer_add_effect(effect_layer, effect_outline, &outline);
  
  // adding background via mask effect
  background.bitmap_background = gbitmap_create_with_resource(RESOURCE_ID_MASK_BG);
  transparent[0] = GColorBlack;
  background.mask_colors = transparent;
  effect_layer_add_effect(effect_layer, effect_mask, &background);
  
  layer_add_child(window_get_root_layer(my_window), effect_layer_get_layer(effect_layer));
  
  
  
}
Exemplo n.º 2
0
void colourswap() {

if (mask.bitmap_background != NULL) {
  gbitmap_destroy(mask.bitmap_background);
  mask.bitmap_background = NULL;
}
	switch (colour) {
		case 0:
		layer_set_hidden(effect_layer_get_layer(effect_layer_mask),true);
		break;
		
		case 1:
		layer_set_hidden(effect_layer_get_layer(effect_layer_mask),false);
		mask.bitmap_background = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MASK7);
		break;
		
		case 2:
		layer_set_hidden(effect_layer_get_layer(effect_layer_mask),false);
  		mask.bitmap_background = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MASK);
		break;
			
		case 3:
		layer_set_hidden(effect_layer_get_layer(effect_layer_mask),false);
		mask.bitmap_background = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MASK2);
		break;
		
		case 4:
		layer_set_hidden(effect_layer_get_layer(effect_layer_mask),false);
		mask.bitmap_background = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MASK6);
		break; 
		
		case 5:
		layer_set_hidden(effect_layer_get_layer(effect_layer_mask),false);
  		mask.bitmap_background = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MASK5);
		break;
			
		case 6:
		layer_set_hidden(effect_layer_get_layer(effect_layer_mask),false);
		mask.bitmap_background = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MASK4);
		break;
		
		case 7:
		layer_set_hidden(effect_layer_get_layer(effect_layer_mask),false);
		mask.bitmap_background = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MASK1);
		break;
		
		case 8:
		layer_set_hidden(effect_layer_get_layer(effect_layer_mask),false);
		mask.bitmap_background = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MASK3);
		break; 
    }
    
	if (mask.bitmap_background != NULL) {
	effect_layer_add_effect(effect_layer_mask, effect_mask, &mask);
	layer_mark_dirty(effect_layer_get_layer(effect_layer_mask));
	}
}
Exemplo n.º 3
0
EffectLayer* create_outline_layer(GRect coords, GColor orig_color, GColor outline_color, int offset_x, int offset_y, EffectOffset *props, Window *window){
  
  EffectLayer *shadow_layer = effect_layer_create(coords);
  
  props->orig_color = orig_color;
  props->offset_color = outline_color;
  props->offset_x = offset_x;
  props->offset_y = offset_y;
  
  effect_layer_add_effect(shadow_layer, effect_outline, props);
  
  layer_add_child(window_get_root_layer(window), effect_layer_get_layer(shadow_layer));
  
  return shadow_layer;
  
}
Exemplo n.º 4
0
EffectLayer* create_shadow_layer(GRect coords, GColor orig_color, GColor shadow_color, int offset_x, int offset_y, int long_shadow, EffectOffset *props, Window *window){
  
  EffectLayer *shadow_layer = effect_layer_create(coords);
  
  props->orig_color = orig_color;
  props->offset_color = shadow_color;
  props->offset_x = offset_x;
  props->offset_y = offset_y;
  props->option = long_shadow;
  
  effect_layer_add_effect(shadow_layer, effect_shadow, props);
  
  layer_add_child(window_get_root_layer(window), effect_layer_get_layer(shadow_layer));
  
  return shadow_layer;
  
}
Exemplo n.º 5
0
void set_invert_color(bool invert) {
  if (invert && effect_layer == NULL) {
    // Add inverter layer
    Layer *window_layer = window_get_root_layer(window);

    effect_layer = effect_layer_create(GRect(53, 2, 65, 166));
    layer_add_child(window_layer, effect_layer_get_layer(effect_layer));
    effect_layer_add_effect(effect_layer, effect_invert, NULL);
	
  } else if (!invert && effect_layer != NULL) {
    // Remove Inverter layer
   layer_remove_from_parent(effect_layer_get_layer(effect_layer));
    effect_layer_destroy(effect_layer);
    effect_layer = NULL;
  }
  // No action required
}
Exemplo n.º 6
0
static void init(void) {
  memset(&time_digits_layers, 0, sizeof(time_digits_layers));
  memset(&time_digits_images, 0, sizeof(time_digits_images));

  memset(&date_digits_layers, 0, sizeof(date_digits_layers));
  memset(&date_digits_images, 0, sizeof(date_digits_images));

 // Setup messaging
  const int inbound_size = 128;
  const int outbound_size = 128;
  app_message_open(inbound_size, outbound_size);	
	
  window = window_create();
  if (window == NULL) {
      //APP_LOG(APP_LOG_LEVEL_DEBUG, "OOM: couldn't allocate window");
      return;
  }
	
  window_set_background_color(window, GColorBlack);

	
  window_stack_push(window, true /* Animated */);
  window_layer = window_get_root_layer(window);
	
	// resources
  custom_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SQUARE_26));

    img_battery_100   = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_090_100);
    img_battery_90   = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_080_090);
    img_battery_80   = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_070_080);
    img_battery_70   = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_060_070);
    img_battery_60   = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_050_060);
    img_battery_50   = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_040_050);
    img_battery_40   = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_030_040);
    img_battery_30    = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_020_030);
    img_battery_20    = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_010_020);
    img_battery_10    = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_000_010);
    img_battery_charge = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_CHARGING);

    // layers
    layer_batt_img  = bitmap_layer_create(GRect(132, 5, 9, 98));
    bitmap_layer_set_bitmap(layer_batt_img, img_battery_100);
	layer_add_child(window_layer, bitmap_layer_get_layer(layer_batt_img));
	
  separator_image = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_SEPARATOR);
#ifdef PBL_PLATFORM_BASALT
  GRect bitmap_bounds = gbitmap_get_bounds(separator_image);
#else
  GRect bitmap_bounds = separator_image->bounds;
#endif	
  GRect frame = GRect(68, 81, bitmap_bounds.size.w, bitmap_bounds.size.h);
  separator_layer = bitmap_layer_create(frame);
  bitmap_layer_set_bitmap(separator_layer, separator_image);
  layer_add_child(window_layer, bitmap_layer_get_layer(separator_layer));   

  bluetooth_image = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BLUETOOTH);
#ifdef PBL_PLATFORM_BASALT
  GRect bitmap_bounds2 = gbitmap_get_bounds(bluetooth_image);
#else
  GRect bitmap_bounds2 = bluetooth_image->bounds;
#endif	
  GRect frame2 = GRect(128, 112, bitmap_bounds2.size.w, bitmap_bounds2.size.h);
  bluetooth_layer = bitmap_layer_create(frame2);
  bitmap_layer_set_bitmap(bluetooth_layer, bluetooth_image);
  layer_add_child(window_layer, bitmap_layer_get_layer(bluetooth_layer));

  Layer *weather_holder = layer_create(GRect(0, 0, 144, 168 ));
  layer_add_child(window_layer, weather_holder);

  icon_layer = bitmap_layer_create(GRect(-3, 100, 60, 75));
  layer_add_child(weather_holder, bitmap_layer_get_layer(icon_layer));
 	
  // Create time and date layers
  GRect dummy_frame = { {0, 0}, {0, 0} };	
   day_name_layer = bitmap_layer_create(dummy_frame);
   layer_add_child(window_layer, bitmap_layer_get_layer(day_name_layer));	
		
   month_layer = bitmap_layer_create(dummy_frame);
   layer_add_child(window_layer, bitmap_layer_get_layer(month_layer));	
	
    for (int i = 0; i < TOTAL_TIME_DIGITS; ++i) {
    time_digits_layers[i] = bitmap_layer_create(dummy_frame);
    layer_add_child(window_layer, bitmap_layer_get_layer(time_digits_layers[i]));
  }
	
    for (int i = 0; i < TOTAL_DATE_DIGITS; ++i) {
    date_digits_layers[i] = bitmap_layer_create(dummy_frame);
    layer_add_child(window_layer, bitmap_layer_get_layer(date_digits_layers[i]));
  }
	
  for (int i = 0; i < TOTAL_SECONDS_DIGITS; ++i) {
    seconds_digits_layers[i] = bitmap_layer_create(dummy_frame);
    layer_add_child(window_layer, bitmap_layer_get_layer(seconds_digits_layers[i]));
  }

  temp_layer = text_layer_create(GRect(120, 135, 40, 40));
  text_layer_set_text_color(temp_layer, GColorWhite);
#ifdef PBL_COLOR	
		text_layer_set_text_color(temp_layer, GColorVividCerulean     );			
#endif
  text_layer_set_background_color(temp_layer, GColorClear);
 // text_layer_set_font(temp_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18));
  text_layer_set_font(temp_layer, custom_font);
  text_layer_set_text_alignment(temp_layer, GTextAlignmentLeft);
  layer_add_child(weather_holder, text_layer_get_layer(temp_layer));
	
 // creating effect layer to rotate temp
  effect_layer_2 = effect_layer_create(GRect(115,135,33,33));
  effect_layer_add_effect(effect_layer_2, effect_rotate_90_degrees, (void *)false);
  layer_add_child(window_get_root_layer(window), effect_layer_get_layer(effect_layer_2));
	
Tuplet initial_values[] = {
    TupletInteger(WEATHER_ICON_KEY, (uint8_t) 14),
    TupletInteger(INVERT_COLOR_KEY, persist_read_bool(INVERT_COLOR_KEY)),
    TupletInteger(BLUETOOTHVIBE_KEY, persist_read_bool(BLUETOOTHVIBE_KEY)),
    TupletInteger(STYLE_KEY, persist_read_bool(STYLE_KEY)),
    TupletInteger(HOURLYVIBE_KEY, persist_read_bool(HOURLYVIBE_KEY)),
    TupletInteger(HIDE_BATT_KEY, persist_read_bool(HIDE_BATT_KEY)),
	TupletInteger(HIDE_DATE_KEY, persist_read_bool(HIDE_DATE_KEY)),
	TupletInteger(HIDE_WEATHER_KEY, persist_read_bool(HIDE_WEATHER_KEY)),
	TupletCString(WEATHER_TEMPERATURE_KEY, ""),

  };

  app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values,
                ARRAY_LENGTH(initial_values), sync_tuple_changed_callback,
                NULL, NULL);

  appStarted = true;

  // Avoids a blank screen on watch start.
  time_t now = time(NULL);
  struct tm *tick_time = localtime(&now);  
  handle_tick(tick_time, MONTH_UNIT + DAY_UNIT + HOUR_UNIT + MINUTE_UNIT + SECOND_UNIT);

  tick_timer_service_subscribe(SECOND_UNIT, handle_tick);	

	 // handlers
    battery_state_service_subscribe(&handle_battery);
    bluetooth_connection_service_subscribe(&handle_bluetooth);
	
	 // draw first frame
    force_update();

}
Exemplo n.º 7
0
static void hands_update_proc(Layer *layer, GContext *ctx) {
  time_t now = time(NULL);
  struct tm *t = localtime(&now);
  
  graphics_context_set_stroke_color(ctx, hand_color);
  
  #ifdef PBL_COLOR
    graphics_context_set_antialiased(ctx, false);
  #endif
  
  GRect bounds = layer_get_bounds(layer);
  GPoint center = grect_center_point(&bounds);
  
  //minute hand
  int16_t hand_length = bounds.size.w / 2 ;
  int32_t angle = TRIG_MAX_ANGLE * t->tm_min / 60;
  GPoint hand = {
    .x = (int16_t)(sin_lookup(angle) * (int32_t)hand_length / TRIG_MAX_RATIO) + center.x,
    .y = (int16_t)(-cos_lookup(angle) * (int32_t)hand_length / TRIG_MAX_RATIO) + center.y,
  };
  #ifdef PBL_COLOR
    graphics_context_set_stroke_width(ctx, 3);
  #endif
  graphics_draw_line(ctx, hand, center);
  
  //hour hand
  hand_length = hand_length - 25;
  angle = (TRIG_MAX_ANGLE * (((t->tm_hour % 12) * 6) + (t->tm_min / 10))) / (12 * 6);
  hand = (GPoint){
    .x = (int16_t)(sin_lookup(angle) * (int32_t)hand_length / TRIG_MAX_RATIO) + center.x,
    .y = (int16_t)(-cos_lookup(angle) * (int32_t)hand_length / TRIG_MAX_RATIO) + center.y,
  };
  #ifdef PBL_COLOR
   graphics_context_set_stroke_width(ctx, 5);
  #endif
  graphics_draw_line(ctx, hand, center);
  
  #ifndef PBL_RECT
    graphics_context_set_fill_color(ctx, hand_color);
    graphics_fill_circle(ctx, center, 7);
  #endif
  
}



static void handle_second_tick(struct tm *tick_time, TimeUnits units_changed) {
  
  #ifndef PBL_COLOR
     memset(aplite_visited, 0, 168*20);
  #endif
  
 
  //adjusting shadow direction according to minute hand location
  if (tick_time->tm_min >= 0 && tick_time->tm_min < 15) {
    s_effect_offset.offset_x = SHADOW_LENGTH;
    s_effect_offset.offset_y = SHADOW_LENGTH;
  } else if (tick_time->tm_min >= 15 && tick_time->tm_min < 30) {
    s_effect_offset.offset_x = -SHADOW_LENGTH;
    s_effect_offset.offset_y = SHADOW_LENGTH;
  } else if (tick_time->tm_min >= 30 && tick_time->tm_min < 45) {  
    s_effect_offset.offset_x = -SHADOW_LENGTH;
    s_effect_offset.offset_y = -SHADOW_LENGTH;  
  } else {
    s_effect_offset.offset_x = SHADOW_LENGTH;
    s_effect_offset.offset_y = -SHADOW_LENGTH;  
  }  
  layer_mark_dirty(window_get_root_layer(window));
}

static void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(window_layer);

  s_hands_layer = layer_create(bounds);
  layer_set_update_proc(s_hands_layer, hands_update_proc);
  layer_add_child(window_layer, s_hands_layer);
  
  //creating shadow layer
  s_effect_offset = (EffectOffset){
    .orig_color = hand_color,
    .offset_color = shadow_color,
    .option = 1
      
    // creating array for "visited" pixels and assigning it to shadow effect parameter
    #ifndef PBL_COLOR  
      ,
      .aplite_visited = aplite_visited
    #endif 
  };
  
  s_effect_layer = effect_layer_create(bounds);
  effect_layer_add_effect(s_effect_layer, effect_shadow, &s_effect_offset);
  effect_layer_add_effect(s_effect_layer, effect_blur, (void*)1);
  layer_add_child(window_layer, effect_layer_get_layer(s_effect_layer));
  
}

static void window_unload(Window *window) {
  layer_destroy(s_hands_layer);
}
Exemplo n.º 8
0
static void init(void) {

  memset(&normal_time_digits_layers, 0, sizeof(normal_time_digits_layers));
  memset(&normal_time_digits_images, 0, sizeof(normal_time_digits_images));
		
  // Setup messaging
  const int inbound_size = 256;
  const int outbound_size = 256;
  app_message_open(inbound_size, outbound_size);	
	
  window = window_create();
  if (window == NULL) {
      //APP_LOG(APP_LOG_LEVEL_DEBUG, "OOM: couldn't allocate window");
      return;
  }
  window_stack_push(window, true /* Animated */);
  window_layer = window_get_root_layer(window);

  window_set_background_color(window, GColorBlack);


  GRect dummy_frame = { {0, 0}, {0, 0} };

	for (int i = 0; i < TOTAL_NORMAL_DIGITS; ++i) {
    normal_time_digits_layers[i] = bitmap_layer_create(dummy_frame);
   layer_add_child(window_layer, bitmap_layer_get_layer(normal_time_digits_layers[i]));
  }	
 
	
	 // ** { begin setup mask for MASK effect
  mask.text = NULL;
  mask.bitmap_mask = NULL;

  #ifdef PBL_COLOR
    mask.mask_colors = malloc(sizeof(GColor)*4);
    mask.mask_colors[0] = GColorWhite;
    mask.mask_colors[1] = GColorDarkGray;
    mask.mask_colors[2] = GColorLightGray;
//    mask.mask_colors[3] = GColorClear;
  #else
    mask.mask_colors = malloc(sizeof(GColor)*2);
    mask.mask_colors[0] = GColorWhite;
    mask.mask_colors[1] = GColorClear;
  #endif
	  
  mask.background_color = GColorClear;
  mask.bitmap_background = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MASK);


  // ** end setup mask }
	
  //creating effect layer
  effect_layer_mask = effect_layer_create(GRect(0,0,144,168));
  effect_layer_add_effect(effect_layer_mask, effect_mask, &mask);
  layer_add_child((window_layer), effect_layer_get_layer(effect_layer_mask));

	
	img_battery_100   = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_080_100);
    img_battery_30   = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_005_030);
    img_battery_00   = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_000_005);
    img_battery_charge = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATT_CHARGING);
    layer_batt_img  = bitmap_layer_create(GRect(66, 102, 9,11));
	bitmap_layer_set_bitmap(layer_batt_img, img_battery_100);
	layer_add_child(window_layer, bitmap_layer_get_layer(layer_batt_img));
		
   bluetooth_image = gbitmap_create_with_resource(RESOURCE_ID_ICON_NOBLUETOOTH);
#ifdef PBL_PLATFORM_BASALT
  GRect bitmap_bounds_bt_on = gbitmap_get_bounds(bluetooth_image);
#else
  GRect bitmap_bounds_bt_on = bluetooth_image->bounds;
#endif	
  GRect frame_bt = GRect(66, 102, bitmap_bounds_bt_on.size.w, bitmap_bounds_bt_on.size.h);
  bluetooth_layer = bitmap_layer_create(frame_bt);
  bitmap_layer_set_bitmap(bluetooth_layer, bluetooth_image);
  layer_add_child(window_layer, bitmap_layer_get_layer(bluetooth_layer));
	
	date_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ODIN_24));

	layer_date_text = text_layer_create(GRect(0, 10, 144, 26));
	text_layer_set_text_color(layer_date_text, GColorWhite);		
    text_layer_set_background_color(layer_date_text, GColorClear);
    text_layer_set_font(layer_date_text, date_font);
    text_layer_set_text_alignment(layer_date_text, GTextAlignmentRight);
    layer_add_child(window_layer, text_layer_get_layer(layer_date_text));

	layer_ampm_text = text_layer_create(GRect(0, 114, 140, 26));
    text_layer_set_text_color(layer_ampm_text, GColorWhite);
	text_layer_set_background_color(layer_ampm_text, GColorClear);
    text_layer_set_font(layer_ampm_text, date_font);
    text_layer_set_text_alignment(layer_ampm_text, GTextAlignmentRight);
    layer_add_child(window_layer, text_layer_get_layer(layer_ampm_text));

	
  // Avoids a blank screen on watch start.
  time_t now = time(NULL);
  struct tm *tick_time = localtime(&now);  
  handle_tick(tick_time, MONTH_UNIT + DAY_UNIT + HOUR_UNIT + MINUTE_UNIT + SECOND_UNIT);

  Tuplet initial_values[] = {
    TupletInteger(BLUETOOTHVIBE_KEY, persist_read_bool(BLUETOOTHVIBE_KEY)),
    TupletInteger(HOURLYVIBE_KEY, persist_read_bool(HOURLYVIBE_KEY)),
	TupletInteger(FLIP_KEY, persist_read_bool(FLIP_KEY)),
	TupletInteger(COLOUR_KEY, persist_read_bool(COLOUR_KEY)),
	TupletInteger(BLINK_KEY, persist_read_bool(BLINK_KEY)),
  };

  app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values,
                ARRAY_LENGTH(initial_values), sync_tuple_changed_callback,
                NULL, NULL);

  appStarted = true;
 
	 // handlers
    battery_state_service_subscribe(&update_battery);
    bluetooth_connection_service_subscribe(&bluetooth_connection_callback);
    tick_timer_service_subscribe(SECOND_UNIT, handle_tick);

	 // draw first frame
    force_update();
}
Exemplo n.º 9
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();
}