Example #1
0
static void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(window_layer);
  // Create sequence
//   s_sequence = gbitmap_sequence_create_with_resource(RESOURCE_ID_SLOTH_ANIMATE);
  // Create blank GBitmap using APNG frame size
//   GSize frame_size = gbitmap_sequence_get_bitmap_size(s_sequence);
//   s_bitmap = gbitmap_create_blank(frame_size, GBitmapFormat8Bit);
  s_bitmap = gbitmap_create_with_resource(RESOURCE_ID_SLOTH_OKAY);
  s_bitmap_layer = bitmap_layer_create(GRect(5, 5, 130, 112));
  bitmap_layer_set_compositing_mode(s_bitmap_layer, GCompOpSet);
  bitmap_layer_set_bitmap(s_bitmap_layer, s_bitmap);

  s_label_layer = make_text_layer(85, 100, FONT_KEY_GOTHIC_24_BOLD);
  s_value_layer = make_text_layer(0, 110, FONT_KEY_ROBOTO_BOLD_SUBSET_49 );
  layer_add_child(window_layer, bitmap_layer_get_layer(s_bitmap_layer));
  layer_add_child(window_layer, text_layer_get_layer(s_value_layer));
  layer_add_child(window_layer, text_layer_get_layer(s_label_layer));
}
Example #2
0
static void window_load(Window *window) {
  Layer *root_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(root_layer);

  int origin = PBL_IF_ROUND_ELSE(59, 49);
  GRect frame = grect_inset(bounds, GEdgeInsets(origin, -10, 0, -10));
  s_brackets_layer = make_text_layer(frame, FontSizeLarge);
  text_layer_set_text(s_brackets_layer, "[    ]");
  layer_add_child(root_layer, text_layer_get_layer(s_brackets_layer));

  origin += 1;
  frame = grect_inset(bounds, GEdgeInsets(origin, 0));
  s_date_layer = make_text_layer(frame, FontSizeMedium);
  layer_add_child(root_layer, text_layer_get_layer(s_date_layer));

  origin += 28;
  frame = grect_inset(bounds, GEdgeInsets(origin, 0, 0, 0));
  s_time_layer = make_text_layer(frame, FontSizeMedium);
  layer_add_child(root_layer, text_layer_get_layer(s_time_layer));

  origin += 52;
  frame = grect_inset(bounds, GEdgeInsets(origin, 0, 0, 0));
  s_battery_layer = make_text_layer(frame, FontSizeSmall);
  layer_add_child(root_layer, text_layer_get_layer(s_battery_layer));

  origin -= PBL_IF_ROUND_ELSE(12, 10);
  s_dashes_layer = layer_create(grect_inset(bounds, GEdgeInsets(origin, 0, 0, 0)));
  layer_set_update_proc(s_dashes_layer, dashes_update_proc);
  layer_add_child(root_layer, s_dashes_layer);

  const int gap = 5;
  const int y_margin = (bounds.size.h - gap) / 2;
  s_bt_layer = layer_create(grect_inset(bounds, GEdgeInsets(y_margin, 0)));
  layer_set_update_proc(s_bt_layer, bt_update_proc);
  layer_add_child(root_layer, s_bt_layer);
}