コード例 #1
0
ファイル: alarmtime.c プロジェクト: lenkawamoto/GentleWake
static void initialise_ui(void) {
    s_window = window_create();
    window_set_background_color(s_window, GColorBlack);
    IF_2(window_set_fullscreen(s_window, true));

    s_res_img_upaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_UPACTION);
    s_res_img_nextaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_NEXTACTION);
    s_res_img_downaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_DOWNACTION);
    s_res_gothic_18_bold = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);
    s_res_bitham_30_black = fonts_get_system_font(FONT_KEY_BITHAM_30_BLACK);
    // action_layer
    action_layer = action_bar_layer_create();
    action_bar_layer_add_to_window(action_layer, s_window);
    action_bar_layer_set_background_color(action_layer, GColorWhite);
    action_bar_layer_set_icon(action_layer, BUTTON_ID_UP, s_res_img_upaction);
    action_bar_layer_set_icon(action_layer, BUTTON_ID_SELECT, s_res_img_nextaction);
    action_bar_layer_set_icon(action_layer, BUTTON_ID_DOWN, s_res_img_downaction);
    layer_set_frame(action_bar_layer_get_layer(action_layer), GRect(124, 0, 20, 168));
    IF_3(layer_set_bounds(action_bar_layer_get_layer(action_layer), GRect(-5, 0, 30, 168)));
    layer_add_child(window_get_root_layer(s_window), (Layer *)action_layer);

    time_layer = layer_create(GRect(0, 0, 124, 168));
    layer_set_update_proc(time_layer, draw_time);
    layer_add_child(window_get_root_layer(s_window), time_layer);
}
コード例 #2
0
ファイル: mainwin.c プロジェクト: SeaPea/HomeP
static void initialise_ui(void) {
  
  s_window = window_create();
  Layer *root_layer = window_get_root_layer(s_window);
  GRect bounds = layer_get_bounds(root_layer); 
  window_set_background_color(s_window, COLOR_FALLBACK(GColorBulgarianRose, GColorBlack)); 
  IF_2(window_set_fullscreen(s_window, false));
  
#ifdef PBL_ROUND
  int dev_layer_left = (bounds.size.w - DEV_LAYER_WIDTH)/2;
  int dev_layer_top = (bounds.size.h - DEV_LAYER_HEIGHT)/2;
#else
  int dev_layer_left = ((bounds.size.w - DEV_LAYER_WIDTH - ACTION_BAR_WIDTH)/2) + 4;
  int dev_layer_top = ((bounds.size.h - DEV_LAYER_HEIGHT - 14)/2) + IF_32(14, 0);
#endif
  
  s_rect_above = GRect(dev_layer_left, -(DEV_LAYER_HEIGHT+2), DEV_LAYER_WIDTH, DEV_LAYER_HEIGHT);
  s_rect_onscreen = GRect(dev_layer_left, dev_layer_top, DEV_LAYER_WIDTH, DEV_LAYER_HEIGHT);
  s_rect_below = GRect(dev_layer_left, bounds.size.h+2, DEV_LAYER_WIDTH, DEV_LAYER_HEIGHT);
  
  // s_devicecard_layer
  s_devicecard_layer = devicecard_layer_create(s_rect_onscreen);
  layer_add_child(root_layer, s_devicecard_layer->layer);
  
  // s_layer_spots
  s_layer_spots = layer_create(PBL_IF_RECT_ELSE(GRect((dev_layer_left/2)-SPOT_RADIUS, dev_layer_top, 
                                                (SPOT_RADIUS*2)+1 , DEV_LAYER_HEIGHT), bounds));
  layer_add_child(root_layer, (Layer *)s_layer_spots);
  
#ifndef PBL_SDK_2
  s_status_bar = status_bar_layer_create();
  status_bar_layer_set_colors(s_status_bar, COLOR_FALLBACK(GColorBulgarianRose, GColorBlack), GColorWhite);
  layer_add_child(root_layer, status_bar_layer_get_layer(s_status_bar));
#endif
  
  s_res_image_action_up = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_UP);
  s_res_image_action_set = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_SET);
  s_res_image_action_down = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_DOWN);
  
  // s_actionbar_main
  s_actionbar_main = action_bar_layer_create();
  action_bar_layer_add_to_window(s_actionbar_main, s_window);
  action_bar_layer_set_background_color(s_actionbar_main, GColorWhite);
  action_bar_layer_set_icon(s_actionbar_main, BUTTON_ID_UP, s_res_image_action_up);
  action_bar_layer_set_icon(s_actionbar_main, BUTTON_ID_SELECT, s_res_image_action_set);
  action_bar_layer_set_icon(s_actionbar_main, BUTTON_ID_DOWN, s_res_image_action_down);
#ifdef PBL_RECT
  layer_set_frame(action_bar_layer_get_layer(s_actionbar_main), GRect(bounds.size.w-20, 0, 20, bounds.size.h));
  IF_3(layer_set_bounds(action_bar_layer_get_layer(s_actionbar_main), GRect(-5, 0, 30, bounds.size.h)));
#endif
  layer_add_child(root_layer, (Layer *)s_actionbar_main);
}
コード例 #3
0
ファイル: skipwin.c プロジェクト: lenkawamoto/GentleWake
static void initialise_ui(void) {
  s_window = window_create();
  window_set_background_color(s_window, GColorBlack);
  IF_2(window_set_fullscreen(s_window, true));
  
  s_res_img_upaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_UPACTION);
  s_res_img_okaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_OKACTION);
  s_res_img_downaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_DOWNACTION);
  s_res_gothic_24 = fonts_get_system_font(FONT_KEY_GOTHIC_24);
  s_res_gothic_28 = fonts_get_system_font(FONT_KEY_GOTHIC_28);
  // s_actionbarlayer
  s_actionbarlayer = action_bar_layer_create();
  action_bar_layer_add_to_window(s_actionbarlayer, s_window);
  action_bar_layer_set_background_color(s_actionbarlayer, GColorWhite);
  action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_UP, s_res_img_upaction);
  action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_SELECT, s_res_img_okaction);
  action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_DOWN, s_res_img_downaction);
  layer_set_frame(action_bar_layer_get_layer(s_actionbarlayer), GRect(124, 0, 20, 168));
  IF_3(layer_set_bounds(action_bar_layer_get_layer(s_actionbarlayer), GRect(-5, 0, 30, 168)));
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_actionbarlayer);
  
  // s_textlayer_info
  s_textlayer_info = text_layer_create(GRect(7, 25, 117, 32));
  text_layer_set_background_color(s_textlayer_info, GColorClear);
  text_layer_set_text_color(s_textlayer_info, GColorWhite);
  text_layer_set_text(s_textlayer_info, "Skip Until:");
  text_layer_set_text_alignment(s_textlayer_info, GTextAlignmentCenter);
  text_layer_set_font(s_textlayer_info, s_res_gothic_24);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_info);
  
  // s_textlayer_date
  s_textlayer_date = text_layer_create(GRect(2, 64, 122, 32));
  text_layer_set_background_color(s_textlayer_date, GColorClear);
  text_layer_set_text_color(s_textlayer_date, GColorWhite);
  text_layer_set_text(s_textlayer_date, "Thu, Feb 22");
  text_layer_set_text_alignment(s_textlayer_date, GTextAlignmentCenter);
  text_layer_set_font(s_textlayer_date, s_res_gothic_28);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_date);
  
  // s_textlayer_status
  s_textlayer_status = text_layer_create(GRect(7, 100, 117, 32));
  text_layer_set_background_color(s_textlayer_status, GColorClear);
  text_layer_set_text_color(s_textlayer_status, GColorWhite);
  text_layer_set_text(s_textlayer_status, "(No skipping)");
  text_layer_set_text_alignment(s_textlayer_status, GTextAlignmentCenter);
  text_layer_set_font(s_textlayer_status, s_res_gothic_24);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_status);
}
コード例 #4
0
ファイル: main.c プロジェクト: imclab/rest
void start_counter(int seconds) {
  m_timer = seconds;
  m_timeout = 0;
  m_in_menu = false;

  // set the initial state - before it's shown
  snprintf(m_counter, sizeof(m_counter), "%d", m_timer);
  text_layer_set_text(s_textlayer_count, m_counter);

  snprintf(m_over, sizeof(m_over), "0:00");
  text_layer_set_text(s_textlayer_over, m_over);

  // hide all others
  layer_set_hidden(text_layer_get_layer(s_textlayer_60), true);
  layer_set_hidden(text_layer_get_layer(s_textlayer_90), true);
  layer_set_hidden(text_layer_get_layer(s_textlayer_120), true);
  layer_set_hidden(action_bar_layer_get_layer(s_actionbarlayer_main), true);

  layer_set_hidden(text_layer_get_layer(s_textlayer_over), true);

    // show counter
  layer_set_hidden(text_layer_get_layer(s_textlayer_count), false);

  tick_timer_service_subscribe(SECOND_UNIT, tick_handler);
}
コード例 #5
0
ファイル: mainwin.c プロジェクト: thisishappenin/GentleWake
static void initialise_ui(void) {
  s_window = window_create();
  window_set_background_color(s_window, GColorBlack);
  IF_A(window_set_fullscreen(s_window, true));
  
  s_res_img_standby = gbitmap_create_with_resource(RESOURCE_ID_IMG_STANDBY);
  s_res_img_settings = gbitmap_create_with_resource(RESOURCE_ID_IMG_SETTINGS);
  s_res_roboto_bold_subset_49 = fonts_get_system_font(FONT_KEY_ROBOTO_BOLD_SUBSET_49);
  s_res_gothic_18_bold = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);
  // action_layer
  action_layer = action_bar_layer_create();
  action_bar_layer_add_to_window(action_layer, s_window);
  action_bar_layer_set_background_color(action_layer, GColorWhite);
  action_bar_layer_set_icon(action_layer, BUTTON_ID_UP, s_res_img_standby);
  action_bar_layer_set_icon(action_layer, BUTTON_ID_DOWN, s_res_img_settings);
  layer_set_frame(action_bar_layer_get_layer(action_layer), GRect(124, 0, 20, 168));
  IF_B(layer_set_bounds(action_bar_layer_get_layer(action_layer), GRect(-5, 0, 30, 168)));
  layer_add_child(window_get_root_layer(s_window), (Layer *)action_layer);
  
  // clockbg_layer
  clockbg_layer = text_layer_create(GRect(0, 60, 144, 50));
  text_layer_set_background_color(clockbg_layer, GColorBlack);
  text_layer_set_text_color(clockbg_layer, GColorClear);
  text_layer_set_text(clockbg_layer, "    ");
  layer_add_child(window_get_root_layer(s_window), (Layer *)clockbg_layer);
  
  // clock_layer
  clock_layer = text_layer_create(GRect(0, 52, 144, 65));
  text_layer_set_background_color(clock_layer, GColorClear);
  text_layer_set_text_color(clock_layer, GColorWhite);
  text_layer_set_text(clock_layer, "23:55");
  text_layer_set_text_alignment(clock_layer, GTextAlignmentCenter);
  text_layer_set_font(clock_layer, s_res_roboto_bold_subset_49);
  layer_add_child(window_get_root_layer(s_window), (Layer *)clock_layer);
  
  // onoff_layer
  onoff_layer = text_layer_create(GRect(2, 2, 119, 56));
  layer_set_update_proc(text_layer_get_layer(onoff_layer), draw_onoff); 
  layer_add_child(window_get_root_layer(s_window), (Layer *)onoff_layer);
  
  // info_layer
  info_layer = text_layer_create(GRect(2, 110, 119, 56));
  layer_set_update_proc(text_layer_get_layer(info_layer), draw_info); 
  layer_add_child(window_get_root_layer(s_window), (Layer *)info_layer);
}
コード例 #6
0
ファイル: mainwin.c プロジェクト: SeaPea/GentleWake
static void initialise_ui(void) {
  
  Layer *root_layer = NULL;
  GRect bounds; 
  s_window = window_create_fullscreen(&root_layer, &bounds);
  
  s_res_img_standby = gbitmap_create_with_resource(RESOURCE_ID_IMG_STANDBY);
  s_res_img_settings = gbitmap_create_with_resource(RESOURCE_ID_IMG_SETTINGS);
  s_res_roboto_bold_subset_49 = fonts_get_system_font(FONT_KEY_ROBOTO_BOLD_SUBSET_49);
  s_res_gothic_18_bold = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);
  // action_layer
  action_layer = action_bar_layer_create();
  action_bar_layer_add_to_window(action_layer, s_window);
  action_bar_layer_set_background_color(action_layer, GColorWhite);
  action_bar_layer_set_icon(action_layer, BUTTON_ID_UP, s_res_img_standby);
  action_bar_layer_set_icon(action_layer, BUTTON_ID_DOWN, s_res_img_settings);
#ifdef PBL_RECT
  layer_set_frame(action_bar_layer_get_layer(action_layer), GRect(bounds.size.w-20, 0, 20, bounds.size.h));
  IF_3(layer_set_bounds(action_bar_layer_get_layer(action_layer), GRect(-6, 0, 31, bounds.size.h)));
  // Put Action Bar underneath other layers on rectangular Pebbles
  layer_add_child(root_layer, action_bar_layer_get_layer(action_layer));
#endif
  
  // clock_layer
  clock_layer = layer_create_with_proc(root_layer, draw_clock,
                                       GRect(0 - PBL_IF_RECT_ELSE(0, ACTION_BAR_WIDTH/2), (bounds.size.h/2)-32-PBL_IF_ROUND_ELSE(2, 0), bounds.size.w, 65));
  
  // onoff_layer
  onoff_layer = layer_create_with_proc(root_layer, draw_onoff,
                                      PBL_IF_RECT_ELSE(GRect(2, (bounds.size.h/2)-82, 119, 56),
                                                   GRect(-10, (bounds.size.h/2)-82, bounds.size.w+11, 56)));
  
  // info_layer
  info_layer = layer_create_with_proc(root_layer, draw_info,
                                     PBL_IF_RECT_ELSE(GRect(2, (bounds.size.h/2)+26, 119, 56),
                                                 GRect(-10, (bounds.size.h/2)+24, bounds.size.w+11, 56)));
  
#ifdef PBL_ROUND
  // Put Action Bar on top for Pebble Round
  layer_add_child(root_layer, (Layer *)action_layer);
#endif
}
コード例 #7
0
ファイル: main.c プロジェクト: imclab/rest
void handle_press_back(ClickRecognizerRef recognizer, void *context) {
  if (m_in_menu) {
    window_stack_pop(true);
  } else {
    tick_timer_service_unsubscribe();

    // hide counter
    layer_set_hidden(text_layer_get_layer(s_textlayer_count), true);
    layer_set_hidden(text_layer_get_layer(s_textlayer_over), true);

    // show all others
    layer_set_hidden(text_layer_get_layer(s_textlayer_60), false);
    layer_set_hidden(text_layer_get_layer(s_textlayer_90), false);
    layer_set_hidden(text_layer_get_layer(s_textlayer_120), false);
    layer_set_hidden(action_bar_layer_get_layer(s_actionbarlayer_main), false);

    m_in_menu = true;
  }
}