您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ window_get_root_layer函数代码示例

51自学网 2021-06-03 09:57:51
  C++
这篇教程C++ window_get_root_layer函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中window_get_root_layer函数的典型用法代码示例。如果您正苦于以下问题:C++ window_get_root_layer函数的具体用法?C++ window_get_root_layer怎么用?C++ window_get_root_layer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了window_get_root_layer函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: window_unload

void window_unload(Window* me) {		layer_remove_child_layers(window_get_root_layer(me));}
开发者ID:El-Sio,项目名称:CANAL--Time,代码行数:4,


示例2: disable_date

static void disable_date(void *data){  draw_date=false;  layer_mark_dirty(window_get_root_layer(window));}
开发者ID:reini1305,项目名称:pastpresentfuture,代码行数:5,


示例3: window_load

static void window_load(Window *window) {  Layer *window_layer = window_get_root_layer(window);  GRect bounds = layer_get_bounds(window_layer);  symbol_layer = text_layer_create(      (GRect) { .origin = { 0, 30 }, .size = { bounds.size.w, 50 } });
开发者ID:matthewess,项目名称:BoilerMake14,代码行数:6,


示例4: time_window_create

TimeWindow* time_window_create(TimeWindowCallbacks callbacks, ETimeState state) {    TimeWindow *time_window = (TimeWindow*)malloc(sizeof(TimeWindow));    if (time_window) {        time_window->window = window_create();        time_window->callbacks = callbacks;        if (time_window->window)         {            time_t current_time = time(NULL);            struct tm* current_tm = localtime(&current_time);                        time_window->field_selection = 0;            time_window->state = state;            time_window->time.digits[0] = current_tm->tm_hour;            time_window->time.digits[1] = current_tm->tm_min;//            for(int i = 0; i < TIME_WINDOW_NUM_CELLS; i++) {//                time_window->time.digits[i] = 0;//            }            // Get window parameters            Layer *window_layer = window_get_root_layer(time_window->window);            GRect bounds = layer_get_bounds(window_layer);            // Main TextLayer            const GEdgeInsets main_text_insets = {.top = 30};            time_window->main_text = text_layer_create(grect_inset(bounds, main_text_insets));            text_layer_set_text(time_window->main_text, "Time Required");            text_layer_set_font(time_window->main_text, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));            text_layer_set_text_alignment(time_window->main_text, GTextAlignmentCenter);            layer_add_child(window_layer, text_layer_get_layer(time_window->main_text));            // Sub TextLayer            const GEdgeInsets sub_text_insets = {.top = 115, .right = 5, .bottom = 10, .left = 5};            time_window->sub_text = text_layer_create(grect_inset(bounds, sub_text_insets));            text_layer_set_text(time_window->sub_text, "up/down to change time");            text_layer_set_text_alignment(time_window->sub_text, GTextAlignmentCenter);            text_layer_set_font(time_window->sub_text, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));            layer_add_child(window_layer, text_layer_get_layer(time_window->sub_text));            // Create selection layer            const GEdgeInsets selection_insets = GEdgeInsets(                (bounds.size.h - TIME_WINDOW_SIZE.h) / 2,                (bounds.size.w - TIME_WINDOW_SIZE.w) / 2);            time_window->selection = selection_layer_create(grect_inset(bounds, selection_insets), TIME_WINDOW_NUM_CELLS);            for (int i = 0; i < TIME_WINDOW_NUM_CELLS; i++) {                selection_layer_set_cell_width(time_window->selection, i, 60);            }            selection_layer_set_cell_padding(time_window->selection, 6);            selection_layer_set_active_bg_color(time_window->selection, GColorRed);            selection_layer_set_inactive_bg_color(time_window->selection, GColorDarkGray);            selection_layer_set_click_config_onto_window(time_window->selection, time_window->window);            selection_layer_set_callbacks(time_window->selection, time_window, (SelectionLayerCallbacks) {                .get_cell_text = selection_handle_get_text,                .complete = selection_handle_complete,                .increment = selection_handle_inc,                .decrement = selection_handle_dec,            });            layer_add_child(window_get_root_layer(time_window->window), time_window->selection);            // Create status bar            time_window->status = status_bar_layer_create();            status_bar_layer_set_colors(time_window->status, GColorClear, GColorBlack);            layer_add_child(window_layer, status_bar_layer_get_layer(time_window->status));            return time_window;        }    }  APP_LOG(APP_LOG_LEVEL_ERROR, "Failed to create TimeWindow");  return NULL;}
开发者ID:xabbudm,项目名称:time-tracker,代码行数:69,


示例5: window_load

static void window_load(Window *window) {  Layer *window_layer = window_get_root_layer(window);  GRect bounds = layer_get_bounds(window_layer);  // init layers  simple_bg_layer = layer_create(bounds);  layer_set_update_proc(simple_bg_layer, bg_update_proc);  layer_add_child(window_layer, simple_bg_layer);    // init bitmaps  background_bitmap = transbitmap_create_with_resource_prefix(RESOURCE_ID_IMAGE_BACKGROUND);  bluetooth_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BLUETOOTH);  battery_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATTERY);  bluetooth_layer = bitmap_layer_create(GRect(1,168-30,30,30));  bitmap_layer_set_bitmap(bluetooth_layer,bluetooth_bitmap);  layer_set_hidden(bitmap_layer_get_layer(bluetooth_layer),true);  battery_layer = bitmap_layer_create(GRect(143-32,167-20,32,20));  bitmap_layer_set_bitmap(battery_layer,battery_bitmap);  layer_set_hidden(bitmap_layer_get_layer(battery_layer),true);      // init hands  hands_layer = layer_create(bounds);  layer_set_update_proc(hands_layer, hands_update_proc);    GFont hour_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_SUBSET_24));  GFont minute_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_SUBSET_20));  for (int i=0;i<12;i++)  {    num_layer[i] = text_layer_create(GRect(1,1,40,20));    snprintf(num_buffer[i],sizeof(num_buffer[i]),"%d",(i)*5);    text_layer_set_text(num_layer[i],num_buffer[i]);    text_layer_set_background_color(num_layer[i], GColorClear);    text_layer_set_text_color(num_layer[i], GColorBlack);    text_layer_set_text_alignment(num_layer[i],GTextAlignmentCenter);    text_layer_set_font(num_layer[i], minute_font);    layer_add_child(window_layer,text_layer_get_layer(num_layer[i]));    layer_set_hidden(text_layer_get_layer(num_layer[i]),true);        hour_layer[i] = text_layer_create(GRect(1,1,48,24));    snprintf(hour_buffer[i],sizeof(hour_buffer[i]),"%d",(i+1));    text_layer_set_text(hour_layer[i],hour_buffer[i]);    text_layer_set_background_color(hour_layer[i], GColorClear);    text_layer_set_text_color(hour_layer[i], GColorBlack);    text_layer_set_font(hour_layer[i], hour_font);    text_layer_set_text_alignment(hour_layer[i],GTextAlignmentCenter);    layer_add_child(window_layer,text_layer_get_layer(hour_layer[i]));    layer_set_hidden(text_layer_get_layer(hour_layer[i]),true);  }      // Inverter Layer  inverter_layer = inverter_layer_create(bounds);  layer_set_hidden(inverter_layer_get_layer(inverter_layer),!getInvert());  layer_add_child(window_layer,inverter_layer_get_layer(inverter_layer));    layer_add_child(window_layer, hands_layer);    // Bluetooth Stuff  bluetooth_connection_service_subscribe(handle_bluetooth);  layer_add_child(window_layer,bitmap_layer_get_layer(bluetooth_layer));  handle_bluetooth(bluetooth_connection_service_peek());    // Battery Stuff  battery_state_service_subscribe(handle_battery);  layer_add_child(window_layer,bitmap_layer_get_layer(battery_layer));  handle_battery(battery_state_service_peek());      // Date Layer  date_layer = text_layer_create(GRect(104,105,32,32));  text_layer_set_text(date_layer,date_buffer);  text_layer_set_background_color(date_layer,GColorClear);  text_layer_set_text_color(date_layer,GColorWhite);  text_layer_set_font(date_layer,hour_font);  text_layer_set_text_alignment(date_layer,GTextAlignmentCenter);  layer_add_child(window_layer,text_layer_get_layer(date_layer));  layer_set_hidden(text_layer_get_layer(date_layer),true);    // force update  time_t now = time(NULL);  struct tm *t = localtime(&now);  snprintf(date_buffer, sizeof(date_buffer), "%d",t->tm_mday);  handle_tick(t, MINUTE_UNIT);  tick_timer_service_subscribe(MINUTE_UNIT, handle_tick);}
开发者ID:reini1305,项目名称:pastpresentfuture,代码行数:87,


示例6: initialise_ui

static void initialise_ui(void) {  s_window = window_create();  #ifndef PBL_SDK_3    window_set_fullscreen(s_window, true);  #endif    s_res_gothic_18_bold = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);  s_res_gothic_14 = fonts_get_system_font(FONT_KEY_GOTHIC_14);  s_res_gothic_24_bold = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);  // txt_train_origin  txt_train_origin = text_layer_create(GRect(5, 0, 134, 21));  text_layer_set_text(txt_train_origin, "Firenze SMN");  text_layer_set_font(txt_train_origin, s_res_gothic_18_bold);  layer_add_child(window_get_root_layer(s_window), (Layer *)txt_train_origin);    // txt_train_code  txt_train_code = text_layer_create(GRect(5, 20, 125, 16));  text_layer_set_text(txt_train_code, "1234");  text_layer_set_font(txt_train_code, s_res_gothic_14);  layer_add_child(window_get_root_layer(s_window), (Layer *)txt_train_code);    // txt_update  txt_update = text_layer_create(GRect(111, 149, 30, 15));  text_layer_set_text_alignment(txt_update, GTextAlignmentRight);  text_layer_set_font(txt_update, s_res_gothic_14);  layer_add_child(window_get_root_layer(s_window), (Layer *)txt_update);    // txt_last_stop  txt_last_stop = text_layer_create(GRect(22, 64, 104, 16));  text_layer_set_text(txt_last_stop, "-");  text_layer_set_font(txt_last_stop, s_res_gothic_14);  layer_add_child(window_get_root_layer(s_window), (Layer *)txt_last_stop);    // txt_next_stop_dt  txt_next_stop_dt = text_layer_create(GRect(22, 121, 38, 20));  text_layer_set_text(txt_next_stop_dt, "--:--");  text_layer_set_font(txt_next_stop_dt, s_res_gothic_14);  layer_add_child(window_get_root_layer(s_window), (Layer *)txt_next_stop_dt);    // txt_next_stop  txt_next_stop = text_layer_create(GRect(21, 104, 112, 18));  text_layer_set_text(txt_next_stop, "-");  text_layer_set_font(txt_next_stop, s_res_gothic_14);  layer_add_child(window_get_root_layer(s_window), (Layer *)txt_next_stop);    // s_textlayer_1  s_textlayer_1 = text_layer_create(GRect(57, 149, 55, 18));  text_layer_set_text(s_textlayer_1, "upd @");  text_layer_set_text_alignment(s_textlayer_1, GTextAlignmentRight);  text_layer_set_font(s_textlayer_1, s_res_gothic_14);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_1);    // txt_next_stop_pf  txt_next_stop_pf = text_layer_create(GRect(86, 121, 42, 20));  text_layer_set_text(txt_next_stop_pf, "-");  text_layer_set_text_alignment(txt_next_stop_pf, GTextAlignmentRight);  text_layer_set_font(txt_next_stop_pf, s_res_gothic_14);  layer_add_child(window_get_root_layer(s_window), (Layer *)txt_next_stop_pf);    // txt_last_stop_dt  txt_last_stop_dt = text_layer_create(GRect(23, 81, 44, 20));  text_layer_set_text(txt_last_stop_dt, "--:--");  text_layer_set_font(txt_last_stop_dt, s_res_gothic_14);  layer_add_child(window_get_root_layer(s_window), (Layer *)txt_last_stop_dt);    // txt_last_stop_pf  txt_last_stop_pf = text_layer_create(GRect(99, 81, 29, 20));  text_layer_set_text(txt_last_stop_pf, "-");  text_layer_set_text_alignment(txt_last_stop_pf, GTextAlignmentRight);  text_layer_set_font(txt_last_stop_pf, s_res_gothic_14);  layer_add_child(window_get_root_layer(s_window), (Layer *)txt_last_stop_pf);    // s_textlayer_2  s_textlayer_2 = text_layer_create(GRect(5, 99, 9, 24));  text_layer_set_text(s_textlayer_2, ">");  text_layer_set_text_alignment(s_textlayer_2, GTextAlignmentCenter);  text_layer_set_font(s_textlayer_2, s_res_gothic_24_bold);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_2);    // s_textlayer_3  s_textlayer_3 = text_layer_create(GRect(2, 60, 13, 24));  text_layer_set_text(s_textlayer_3, "<");  text_layer_set_text_alignment(s_textlayer_3, GTextAlignmentCenter);  text_layer_set_font(s_textlayer_3, s_res_gothic_24_bold);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_3);    // txt_train_delay  txt_train_delay = text_layer_create(GRect(22, 39, 100, 20));  text_layer_set_text(txt_train_delay, "Text layer");  text_layer_set_text_alignment(txt_train_delay, GTextAlignmentCenter);  layer_add_child(window_get_root_layer(s_window), (Layer *)txt_train_delay);}
开发者ID:flerro,项目名称:pebble-intreno,代码行数:92,


示例7: init_settings_window

//.........这里部分代码省略.........    menu_section1_items[i++] = (SimpleMenuItem) {      .title = _("Middle"),      .subtitle = _("Change screen"),    };    menu_section1_items[i++] = (SimpleMenuItem) {      .title = _("Down"),      .subtitle = _("Menu / Zoom map"),    };    menu_section1_items[i++] = (SimpleMenuItem) {      .title = _("Back"),      .subtitle = _("Double click to exit"),    };    // Header    menu_sections[s++] = (SimpleMenuSection) {      .title = _("Buttons"),      .items = menu_section1_items,      .num_items = ARRAY_LENGTH(menu_section1_items)    };#endif  // Section "About"  i = 0;  menu_section2_items[i++] = (SimpleMenuItem) {    .title = "Ventoo",    .subtitle = VERSION_TEXT,  };  menu_section2_items[i++] = (SimpleMenuItem) {    .title = _("Authors"),    .subtitle = APP_COMPANY,  };  menu_section2_items[i++] = (SimpleMenuItem) {    .title = _("More info"),    .subtitle = "http://pebblebike.com",  };  BatteryChargeState charge_state = battery_state_service_peek();  snprintf(pebble_battery_level, sizeof(pebble_battery_level), "%d %%", charge_state.charge_percent);  menu_section2_items[i++] = (SimpleMenuItem) {    .title = _("Pebble battery"),    .subtitle = pebble_battery_level,  };  //APP_LOG(APP_LOG_LEVEL_DEBUG, "phone_battery_level:%ld", s_data.phone_battery_level);  if (s_data.phone_battery_level > 0) {    snprintf(phone_battery_level, sizeof(phone_battery_level), "%ld %%", s_data.phone_battery_level);  } else {    snprintf(phone_battery_level, sizeof(phone_battery_level), "-");  }  menu_section2_items[i++] = (SimpleMenuItem) {    .title = _("Phone battery"),    .subtitle = phone_battery_level,  };  // Header  menu_sections[s++] = (SimpleMenuSection) {    .title = _("About"),    .items = menu_section2_items,    .num_items = ARRAY_LENGTH(menu_section2_items)  };  Layer *window_layer = window_get_root_layer(window);  GRect bounds = layer_get_frame(window_layer);  // Initialize the simple menu layer  menu_layer = simple_menu_layer_create(bounds, window, menu_sections, ARRAY_LENGTH(menu_sections), NULL);  // Add it to the window for display  layer_add_child(window_layer, simple_menu_layer_get_layer(menu_layer));  }/** * Public functions */void menu_show(){  init_settings_window();  window_stack_push(window, true);}void window_disappear(Window *window) {  simple_menu_layer_destroy(menu_layer);}void menu_init() {  window = window_create();#ifdef PBL_SDK_2  window_set_fullscreen(window, true);#endif  window_set_window_handlers(window, (WindowHandlers) {    .appear = (WindowHandler)handle_appear,    .disappear = window_disappear,  });  }void menu_deinit() {  window_destroy(window);}
开发者ID:jay3,项目名称:Ventoo-PebbleWatchFace,代码行数:101,


示例8: init

static void init() {  window = window_create();  window_stack_push(window, true);  window_set_background_color(window, GColorBlack);    // Custom fonts  GFont timeFont = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TEXT_TIME_30));  GFont amFont = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TEXT_AM_18));	  //  AM / PM Layer  amLayer = text_layer_create(GRect(10, 60, 144-20, 24));  text_layer_set_text(amLayer, "");  text_layer_set_font(amLayer, amFont);  text_layer_set_text_color(amLayer, GColorWhite);  text_layer_set_background_color(amLayer, GColorClear);  text_layer_set_text_alignment(amLayer, GTextAlignmentLeft);  // Hour layer  hourLayer = text_layer_create(GRect(0, 75, 144-70, 50));  text_layer_set_font(hourLayer, timeFont);  text_layer_set_text_color(hourLayer, GColorWhite);  text_layer_set_background_color(hourLayer, GColorClear);  text_layer_set_text_alignment(hourLayer, GTextAlignmentRight);  // Separator layer  GRect rect = layer_get_frame(text_layer_get_layer(hourLayer));  rect.origin.x = rect.size.w;  rect.size.w = 20;  dotsLayer = text_layer_create(rect);  text_layer_set_text(dotsLayer, ":");  text_layer_set_font(dotsLayer, timeFont);  text_layer_set_text_color(dotsLayer, GColorWhite);  text_layer_set_background_color(dotsLayer, GColorClear);  text_layer_set_text_alignment(dotsLayer, GTextAlignmentCenter);    // Minutes layer  rect = layer_get_frame(text_layer_get_layer(dotsLayer));  rect.origin.x += rect.size.w;  rect.size.w = 144-rect.origin.x;  minuteLayer = text_layer_create(rect);  text_layer_set_font(minuteLayer, timeFont);  text_layer_set_text_color(minuteLayer, GColorWhite);  text_layer_set_background_color(minuteLayer, GColorClear);  text_layer_set_text_alignment(minuteLayer, GTextAlignmentLeft);    // Configure time on init	// Configure time on init  time_t now = time(NULL);  struct tm *t = localtime(&now);	display_time(t);	// Load layers	Layer *window_layer = window_get_root_layer(window);  layer_add_child(window_layer, text_layer_get_layer(amLayer));  layer_add_child(window_layer, text_layer_get_layer(hourLayer));  layer_add_child(window_layer, text_layer_get_layer(dotsLayer));  layer_add_child(window_layer, text_layer_get_layer(minuteLayer));		// Handle minute tick	tick_timer_service_subscribe(MINUTE_UNIT, handle_minute_tick);}
开发者ID:mmdumi,项目名称:pebblePhosphor,代码行数:62,


示例9: handle_second_tick

static void handle_second_tick(struct tm *tick_time, TimeUnits units_changed) {  layer_mark_dirty(window_get_root_layer(window));}
开发者ID:43403901,项目名称:pebble-sdk-examples,代码行数:3,


示例10: pin_window_create

PinWindow* pin_window_create(PinWindowCallbacks callbacks) {  PinWindow *pin_window = (PinWindow*)malloc(sizeof(PinWindow));  if (pin_window) {    pin_window->window = window_create();    pin_window->callbacks = callbacks;    if (pin_window->window) {      pin_window->field_selection = 0;      for(int i = 0; i < NUM_CELLS; i++) {        pin_window->pin.digits[i] = 0;      }            // Get window parameters      Layer *window_layer = window_get_root_layer(pin_window->window);      GRect bounds = layer_get_bounds(window_layer);            // Main TextLayer#ifdef PBL_SDK_3      pin_window->main_text = text_layer_create(GRect(0, 30, bounds.size.w, 40));#else      pin_window->main_text = text_layer_create(GRect(0, 15, bounds.size.w, 40));#endif      text_layer_set_text(pin_window->main_text, "How many?");      text_layer_set_font(pin_window->main_text, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));      text_layer_set_text_alignment(pin_window->main_text, GTextAlignmentCenter);      layer_add_child(window_layer, text_layer_get_layer(pin_window->main_text));            // Sub TextLayer#ifdef PBL_SDK_3      pin_window->sub_text = text_layer_create(GRect(1, 125, bounds.size.w, 40));#else      pin_window->sub_text = text_layer_create(GRect(1, 110, bounds.size.w, 40));#endif      // Create selection layer#ifdef PBL_SDK_3      pin_window->selection = selection_layer_create(GRect(8, 75, 128, 34), NUM_CELLS);#else      pin_window->selection = selection_layer_create(GRect(8, 60, 128, 34), NUM_CELLS);#endif      for (int i = 0; i < NUM_CELLS; i++) {        selection_layer_set_cell_width(pin_window->selection, i, 40);      }      selection_layer_set_cell_padding(pin_window->selection, 4);#ifdef PBL_COLOR      selection_layer_set_active_bg_color(pin_window->selection, GColorRed);      selection_layer_set_inactive_bg_color(pin_window->selection, GColorDarkGray);#endif      selection_layer_set_click_config_onto_window(pin_window->selection, pin_window->window);      selection_layer_set_callbacks(pin_window->selection, pin_window, (SelectionLayerCallbacks) {        .get_cell_text = selection_handle_get_text,        .complete = selection_handle_complete,        .increment = selection_handle_inc,        .decrement = selection_handle_dec,      });      layer_add_child(window_get_root_layer(pin_window->window), pin_window->selection);#ifdef PBL_SDK_3#endif      return pin_window;    }
开发者ID:moakq,项目名称:moneytimePebbleMana,代码行数:61,


示例11: window_load

static void window_load(){    // Create window    Layer *window_layer = window_get_root_layer(window);    GRect bounds = layer_get_bounds(window_layer);    // Background layer    s_bg_layer = layer_create(bounds);    layer_set_update_proc(s_bg_layer, bg_update_proc);    layer_add_child(window_layer, s_bg_layer);    // Time layer    s_time_layer = layer_create(bounds);    layer_set_update_proc(s_time_layer, time_update_proc);    layer_add_child(window_layer, s_time_layer);    // Date layer    s_date_layer = layer_create(bounds);    layer_set_update_proc(s_date_layer, date_update_proc);    layer_add_child(window_layer, s_date_layer);    // Battery layer    s_battery_bitmap[0] = gbitmap_create_with_resource(RESOURCE_ID_BATTERY);    s_battery_bitmap[1] = gbitmap_create_with_resource(RESOURCE_ID_BATTERY_CHARGING);    s_battery_layer = layer_create(bounds);    layer_set_update_proc(s_battery_layer, battery_update_proc);    layer_add_child(window_layer, s_battery_layer);    // Bluetooth layer    s_bt_bitmap = gbitmap_create_with_resource(RESOURCE_ID_BLUETOOTH);    s_bt_layer = layer_create(bounds);    layer_set_update_proc(s_bt_layer, bt_update_proc);    layer_add_child(window_layer, s_bt_layer);    // Weather layer    s_weather_bitmap[0] = gbitmap_create_with_resource(RESOURCE_ID_W01D);    s_weather_bitmap[1] = gbitmap_create_with_resource(RESOURCE_ID_W01N);    s_weather_bitmap[2] = gbitmap_create_with_resource(RESOURCE_ID_W02D);    s_weather_bitmap[3] = gbitmap_create_with_resource(RESOURCE_ID_W02N);    s_weather_bitmap[4] = gbitmap_create_with_resource(RESOURCE_ID_W03);    s_weather_bitmap[5] = gbitmap_create_with_resource(RESOURCE_ID_W04);    s_weather_bitmap[6] = gbitmap_create_with_resource(RESOURCE_ID_W09);    s_weather_bitmap[7] = gbitmap_create_with_resource(RESOURCE_ID_W10D);    s_weather_bitmap[8] = gbitmap_create_with_resource(RESOURCE_ID_W10N);    s_weather_bitmap[9] = gbitmap_create_with_resource(RESOURCE_ID_W11);    s_weather_bitmap[10] = gbitmap_create_with_resource(RESOURCE_ID_W13);    s_weather_bitmap[11] = gbitmap_create_with_resource(RESOURCE_ID_W50);    s_weather_layer = layer_create(bounds);    layer_set_update_proc(s_weather_layer, weather_update_proc);    layer_add_child(window_layer, s_weather_layer);    // Foreground layer    s_bitmap = gbitmap_create_with_resource(RESOURCE_ID_FRAME);    s_fg_layer = layer_create(bounds);    layer_set_update_proc(s_fg_layer, fg_update_proc);    layer_add_child(window_layer, s_fg_layer);    // Time Zone layer    s_window_bitmap = gbitmap_create_with_resource(RESOURCE_ID_WINDOW);    s_tz_layer = layer_create(bounds);    layer_set_update_proc(s_tz_layer, tz_update_proc);    layer_add_child(window_layer, s_tz_layer);    // Init callback    bluetooth_callback(bluetooth_connection_service_peek());    battery_callback(battery_state_service_peek());    // Init    s_weather_temp = persist_exists(KEY_TEMPERATURE) ? persist_read_int(KEY_TEMPERATURE) : -100;    s_weather_icon = persist_exists(KEY_ICON) ? persist_read_int(KEY_ICON) : -1;    s_last_update_time = persist_exists(KEY_LAST_WEATHER_UPDATE_TIME) ? persist_read_int(KEY_LAST_WEATHER_UPDATE_TIME) : -1;    s_ad_time_zone = persist_exists(KEY_ADTZ) ? persist_read_int(KEY_ADTZ) : 0;    s_vibe_bt = persist_exists(KEY_BLUETOOTH_VIBE) ? persist_read_int(KEY_BLUETOOTH_VIBE) : 0;    s_vibe_hourly = persist_exists(KEY_HOURLY_VIBE) ? persist_read_int(KEY_HOURLY_VIBE) : 0;    s_hour_r = persist_exists(KEY_HOUR_RED) ? persist_read_int(KEY_HOUR_RED) : 0;    s_hour_g = persist_exists(KEY_HOUR_GREEN) ? persist_read_int(KEY_HOUR_GREEN) : 170;    s_hour_b = persist_exists(KEY_HOUR_BLUE) ? persist_read_int(KEY_HOUR_BLUE) : 255;    s_minute_r = persist_exists(KEY_MINUTE_RED) ? persist_read_int(KEY_MINUTE_RED) : 255;    s_minute_g = persist_exists(KEY_MINUTE_GREEN) ? persist_read_int(KEY_MINUTE_GREEN) : 0;    s_minute_b = persist_exists(KEY_MINUTE_BLUE) ? persist_read_int(KEY_MINUTE_BLUE) : 0;    s_second_r = persist_exists(KEY_SECOND_RED) ? persist_read_int(KEY_SECOND_RED) : 0;    s_second_g = persist_exists(KEY_SECOND_GREEN) ? persist_read_int(KEY_SECOND_GREEN) : 255;    s_second_b = persist_exists(KEY_SECOND_BLUE) ? persist_read_int(KEY_SECOND_BLUE) : 0;    s_ps_start_time = persist_exists(KEY_POWER_SAVING_START) ? persist_read_int(KEY_POWER_SAVING_START) : 0;    s_ps_end_time = persist_exists(KEY_POWER_SAVING_END) ? persist_read_int(KEY_POWER_SAVING_END) : 0;    s_second_bar = persist_exists(KEY_SECOND_BAR) ? persist_read_int(KEY_SECOND_BAR) : 0;    s_second_bar_r = persist_exists(KEY_SECOND_BAR_RED) ? persist_read_int(KEY_SECOND_BAR_RED) : 0;    s_second_bar_g = persist_exists(KEY_SECOND_BAR_GREEN) ? persist_read_int(KEY_SECOND_BAR_GREEN) : 255;    s_second_bar_b = persist_exists(KEY_SECOND_BAR_BLUE) ? persist_read_int(KEY_SECOND_BAR_BLUE) : 0;    s_second_rate = persist_exists(KEY_SECOND_REFRESH_RATE) ? persist_read_int(KEY_SECOND_REFRESH_RATE) : 0;    s_12hour = persist_exists(KEY_12HOUR) ? persist_read_bool(KEY_12HOUR) : false;    if (s_second_rate < 2)    {        app_timer_register(1000, animation_timer_callback, NULL);    }    else if (s_second_rate == 2)    {        app_timer_register(500, animation_timer_callback, NULL);    }//.........这里部分代码省略.........
开发者ID:TsFreddie,项目名称:gear-pebble,代码行数:101,


示例12: create_objects

// Creates all of the objects needed for the watch.  Normally called// only by handle_init(), but might be invoked midstream in a// memory-panic situation.void create_objects() {  app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "create_objects");  window = window_create();  assert(window != NULL);  struct WindowHandlers window_handlers;  memset(&window_handlers, 0, sizeof(window_handlers));  window_handlers.load = window_load_handler;  window_handlers.appear = window_appear_handler;  window_handlers.disappear = window_disappear_handler;  window_handlers.unload = window_unload_handler;  window_set_window_handlers(window, window_handlers);  window_set_fullscreen(window, true);  window_stack_push(window, false);  hand_cache_init(&hour_cache);  hand_cache_init(&minute_cache);  hand_cache_init(&second_cache);  Layer *window_layer = window_get_root_layer(window);  GRect window_frame = layer_get_frame(window_layer);  clock_face_layer = layer_create(window_frame);  assert(clock_face_layer != NULL);  layer_set_update_proc(clock_face_layer, &clock_face_layer_update_callback);  layer_add_child(window_layer, clock_face_layer);  {    const struct IndicatorTable *window = &battery_table[config.face_index];    init_battery_gauge(window_layer, window->x, window->y, window->invert, window->opaque);  }  {    const struct IndicatorTable *window = &bluetooth_table[config.face_index];    init_bluetooth_indicator(window_layer, window->x, window->y, window->invert, window->opaque);  }  for (int i = 0; i < NUM_DATE_WINDOWS; ++i) {    const struct IndicatorTable *window = &date_windows[i][config.face_index];    Layer *layer = layer_create_with_data(GRect(window->x - 19, window->y - 8, 39, 19), sizeof(DateWindowData));    assert(layer != NULL);    date_window_layers[i] = layer;    DateWindowData *data = (DateWindowData *)layer_get_data(layer);    data->date_window_index = i;    layer_set_update_proc(layer, &date_window_layer_update_callback);    layer_add_child(window_layer, layer);  }#ifdef MAKE_CHRONOGRAPH  create_chrono_objects();#endif  // MAKE_CHRONOGRAPH  // Init all of the hands, taking care to arrange them in the correct  // stacking order.  int i;  for (i = 0; stacking_order[i] != STACKING_ORDER_DONE; ++i) {    switch (stacking_order[i]) {    case STACKING_ORDER_HOUR:      hour_layer = layer_create(window_frame);      assert(hour_layer != NULL);      layer_set_update_proc(hour_layer, &hour_layer_update_callback);      layer_add_child(window_layer, hour_layer);      break;    case STACKING_ORDER_MINUTE:      minute_layer = layer_create(window_frame);      assert(minute_layer != NULL);      layer_set_update_proc(minute_layer, &minute_layer_update_callback);      layer_add_child(window_layer, minute_layer);      break;    case STACKING_ORDER_SECOND:      second_layer = layer_create(window_frame);      assert(second_layer != NULL);      layer_set_update_proc(second_layer, &second_layer_update_callback);      layer_add_child(window_layer, second_layer);      break;    case STACKING_ORDER_CHRONO_MINUTE:#if defined(ENABLE_CHRONO_MINUTE_HAND) && defined(MAKE_CHRONOGRAPH)      chrono_minute_layer = layer_create(window_frame);      assert(chrono_minute_layer != NULL);      layer_set_update_proc(chrono_minute_layer, &chrono_minute_layer_update_callback);      layer_add_child(window_layer, chrono_minute_layer);#endif  // ENABLE_CHRONO_MINUTE_HAND      break;    case STACKING_ORDER_CHRONO_SECOND:#if defined(ENABLE_CHRONO_SECOND_HAND) && defined(MAKE_CHRONOGRAPH)      chrono_second_layer = layer_create(window_frame);      assert(chrono_second_layer != NULL);      layer_set_update_proc(chrono_second_layer, &chrono_second_layer_update_callback);      layer_add_child(window_layer, chrono_second_layer);#endif  // ENABLE_CHRONO_SECOND_HAND      break;//.........这里部分代码省略.........
开发者ID:docsmooth,项目名称:laughingman,代码行数:101,


示例13: main_window_load

static void main_window_load(Window *window) {      // Set up the weather areas  // Use system font, apply it and add to Window  s_weather_font = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD);  s_weather_title_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);    //Create GBitmap, then set to created BitmapLayer  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BACKGROUND);  s_background_layer = bitmap_layer_create(GRect(0, 0, 144, 168));  bitmap_layer_set_bitmap(s_background_layer, s_background_bitmap);  layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_background_layer));    // Create time TextLayer  s_time_layer = text_layer_create(GRect(0, 138, 144, 30));  text_layer_set_background_color(s_time_layer, GColorClear);  text_layer_set_text_color(s_time_layer, GColorWhite);    //Apply to TextLayer  text_layer_set_font(s_time_layer, s_weather_font);  text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);    // Add it as a child layer to the Window's root layer  layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_time_layer));  // Set some intial string  text_layer_set_text(s_time_layer, "00:00:00");      // Create temperature Layer  s_weather_layer[0] = text_layer_create(GRect(0, 0, 144, 28));  s_weather_title[0] = text_layer_create(GRect(0, 28, 144, 18));  s_weather_layer[1] = text_layer_create(GRect(0, 46, 144, 28));  s_weather_title[1] = text_layer_create(GRect(0, 74, 144, 18));  s_weather_layer[2] = text_layer_create(GRect(0, 92, 144, 28));  s_weather_title[2] = text_layer_create(GRect(0, 120, 144, 18));    int i;  for (i =0; i < 3; i++)    {    text_layer_set_background_color(s_weather_layer[i], GColorClear);    text_layer_set_text_color(s_weather_layer[i], GColorWhite);    text_layer_set_text_alignment(s_weather_layer[i], GTextAlignmentCenter);    text_layer_set_text(s_weather_layer[i], "00-00 NNN");    text_layer_set_font(s_weather_layer[i], s_weather_font);    layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_weather_layer[i]));    text_layer_set_background_color(s_weather_title[i], GColorClear);    text_layer_set_text_color(s_weather_title[i], GColorWhite);    text_layer_set_text_alignment(s_weather_title[i], GTextAlignmentCenter);    text_layer_set_font(s_weather_title[i], s_weather_title_font);    layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_weather_title[i]));  }    text_layer_set_text(s_weather_title[0], "North Head");  text_layer_set_text(s_weather_title[1], "Sydney Harbour");  text_layer_set_text(s_weather_title[2], "Fort Denison");    // Make sure the time is displayed from the start  update_time();}
开发者ID:johnhmacleod,项目名称:pebbleapps,代码行数:64,


示例14: handle_init

//Hippo Command, I put my pants on backwards!void handle_init(void) {    APP_LOG(APP_LOG_LEVEL_DEBUG, "INIT MEMORY: %u bytes used, %u bytes free", (unsigned) heap_bytes_used(), (unsigned) heap_bytes_free());        // TODO: restore this once done profiling#ifndef LOCK_SHIP    srand(time(NULL));    load_holomesh(rand() % c_craft_info_count);#else    load_holomesh(LOCK_SHIP);#endif        APP_LOG(APP_LOG_LEVEL_DEBUG, "UI MEMORY: %u bytes used, %u bytes free", (unsigned) heap_bytes_used(), (unsigned) heap_bytes_free());    my_window = window_create();    window_set_background_color(my_window, GColorBlack);    GRect logoRect = GRect(0, 12, c_viewportWidth, c_viewportWidth);    logoLayer = bitmap_layer_create(logoRect);    bitmap_layer_set_bitmap(logoLayer, logoBitmap);    layer_add_child(window_get_root_layer(my_window), bitmap_layer_get_layer(logoLayer));    // Fonts        g_font_sw = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_14));    g_font_sw_symbol = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SYMBOL_14));    g_font_time = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD);    g_font_info = fonts_get_system_font(FONT_KEY_GOTHIC_14);        // Paint layer    frameBufferLayer = bitmap_layer_create(GRect(0, 0, c_viewportWidth, c_viewportHeight));    layer_add_child(window_get_root_layer(my_window), bitmap_layer_get_layer(frameBufferLayer));        frameBufferBitmap = gbitmap_create_blank_with_palette(        GSize(c_viewportWidth, c_viewportHeight),        GBitmapFormat2BitPalette,        c_palette,        false);    bitmap_layer_set_bitmap(frameBufferLayer, frameBufferBitmap);    bitmap_layer_set_compositing_mode(frameBufferLayer, GCompOpSet);        paint();    GRect layerSize = GRect(0, 0, c_viewportWidth, c_viewportHeight);    // Two small text layers    textLayer = text_layer_create(layerSize);    text_layer_set_background_color(textLayer, GColorClear);    text_layer_set_text_color(textLayer, GColorYellow);    text_layer_set_font(textLayer, g_font_sw);    layer_add_child(window_get_root_layer(my_window), text_layer_get_layer(textLayer));    //Jet Force Push-up, you silly-billy.       textLayerSym = text_layer_create(layerSize);    text_layer_set_background_color(textLayerSym, GColorClear);    text_layer_set_text_color(textLayerSym, GColorYellow);    text_layer_set_font(textLayerSym, g_font_sw_symbol);    layer_set_hidden(text_layer_get_layer(textLayerSym), true);    layer_add_child(window_get_root_layer(my_window), text_layer_get_layer(textLayerSym));    //Hippo Command, I also put my watch on backwards!    // Info text layer    infoTextLayer = text_layer_create(layerSize);    text_layer_set_background_color(infoTextLayer, GColorClear);    text_layer_set_text_color(infoTextLayer, GColorYellow);    text_layer_set_font(infoTextLayer, g_font_info);    layer_add_child(window_get_root_layer(my_window), text_layer_get_layer(infoTextLayer));        // Time    GSize timeSize = graphics_text_layout_get_content_size(        "00:00 AM",        g_font_time,        layerSize,        0,        GTextAlignmentLeft);    GRect timeRect = { GPoint(DT_EDGE_PAD, c_viewportHeight - timeSize.h), GSize(c_viewportWidth, timeSize.h) };    timeLayer = text_layer_create(timeRect);    text_layer_set_background_color(timeLayer, GColorClear);    text_layer_set_text_color(timeLayer, GColorYellow);    text_layer_set_font(timeLayer, g_font_time);    //text_layer_set_text(timeLayer, "23:45 AM");    layer_add_child(window_get_root_layer(my_window), text_layer_get_layer(timeLayer));        // Date    dateLayer = text_layer_create(layerSize);    text_layer_set_background_color(dateLayer, GColorClear);    text_layer_set_text_color(dateLayer, GColorYellow);    text_layer_set_font(dateLayer, g_font_info);    layer_add_child(window_get_root_layer(my_window), text_layer_get_layer(dateLayer));        time_t t = time(NULL);    update_time_display(localtime(&t));    update_date_display(localtime(&t));    update_title_and_info();        APP_LOG(APP_LOG_LEVEL_DEBUG, "FINAL MEMORY: %u bytes used, %u bytes free", (unsigned) heap_bytes_used(), (unsigned) heap_bytes_free());        window_stack_push(my_window, true);//.........这里部分代码省略.........
开发者ID:PJayB,项目名称:BlueHarvestPebbleTime,代码行数:101,


示例15: initialise_ui

static void initialise_ui(void) {  s_window = window_create();  #ifndef PBL_SDK_3    window_set_fullscreen(s_window, true);  #endif    s_res_roboto_bold_subset_49 = fonts_get_system_font(FONT_KEY_ROBOTO_BOLD_SUBSET_49);  s_res_roboto_condensed_21 = fonts_get_system_font(FONT_KEY_ROBOTO_CONDENSED_21);    // s_time  s_time = text_layer_create(GRect(0, 0, 144, 25));  text_layer_set_text(s_time, "12:34");  text_layer_set_text_alignment(s_time, GTextAlignmentCenter);  text_layer_set_font(s_time, s_res_roboto_condensed_21);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_time);    // s_time_elapsed  s_time_elapsed = text_layer_create(GRect(0, 25, 144, 25));  text_layer_set_background_color(s_time_elapsed, GColorClear);  text_layer_set_text_color(s_time_elapsed, GColorBlack);  text_layer_set_text(s_time_elapsed, "00:00:00");  text_layer_set_text_alignment(s_time_elapsed, GTextAlignmentCenter);  text_layer_set_font(s_time_elapsed, s_res_roboto_condensed_21);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_time_elapsed);    // s_countdown  s_countdown = text_layer_create(GRect(20, 50, 100, 49));  text_layer_set_background_color(s_countdown, GColorClear);  text_layer_set_text(s_countdown, "23");  text_layer_set_text_alignment(s_countdown, GTextAlignmentCenter);  text_layer_set_font(s_countdown, s_res_roboto_bold_subset_49);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_countdown);    // s_countup  s_countup = text_layer_create(GRect(20, 108, 100, 23));  text_layer_set_background_color(s_countup, GColorClear);  text_layer_set_text(s_countup, "37");  text_layer_set_text_alignment(s_countup, GTextAlignmentCenter);  text_layer_set_font(s_countup, s_res_roboto_condensed_21);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_countup);    // s_set  s_set = text_layer_create(GRect(0, 143, 144, 25));  text_layer_set_text(s_set, "Set: 1");  text_layer_set_font(s_set, s_res_roboto_condensed_21);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_set);    // s_menubar  s_menubar = bitmap_layer_create(GRect(112, 0, 32, 168));  bitmap_layer_set_background_color(s_menubar, GColorBlack);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_menubar);    // s_restart1  s_restart1 = text_layer_create(GRect(108, 15, 35, 21));  text_layer_set_background_color(s_restart1, GColorClear);  text_layer_set_text_color(s_restart1, GColorWhite);  text_layer_set_text(s_restart1, "1");  text_layer_set_text_alignment(s_restart1, GTextAlignmentRight);  text_layer_set_font(s_restart1, s_res_roboto_condensed_21);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_restart1);    // s_restart2  s_restart2 = text_layer_create(GRect(108, 70, 35, 21));  text_layer_set_background_color(s_restart2, GColorClear);  text_layer_set_text_color(s_restart2, GColorWhite);  text_layer_set_text(s_restart2, "2");  text_layer_set_text_alignment(s_restart2, GTextAlignmentRight);  text_layer_set_font(s_restart2, s_res_roboto_condensed_21);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_restart2);    // s_restart3  s_restart3 = text_layer_create(GRect(108, 129, 35, 21));  text_layer_set_background_color(s_restart3, GColorClear);  text_layer_set_text_color(s_restart3, GColorWhite);  text_layer_set_text(s_restart3, "3");  text_layer_set_text_alignment(s_restart3, GTextAlignmentRight);  text_layer_set_font(s_restart3, s_res_roboto_condensed_21);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_restart3);    /*  // s_duration  s_duration = text_layer_create(GRect(20, 43, 100, 23));  text_layer_set_background_color(s_duration, GColorClear);  text_layer_set_text(s_duration, "12");  text_layer_set_text_alignment(s_duration, GTextAlignmentCenter);  text_layer_set_font(s_duration, s_res_roboto_condensed_21);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_duration);  */}
开发者ID:eviltobz,项目名称:pebble_jim,代码行数:89,


示例16: window_load

static void window_load(Window *window) {    Layer *window_layer = window_get_root_layer(window);    GRect bounds = layer_get_bounds(window_layer);    s_layer = layer_create(layer_get_bounds(window_get_root_layer(window)));    layer_add_child(window_get_root_layer(window), s_layer);    layer_set_update_proc(s_layer, draw_watchface);    uint16_t vert_padding = (bounds.size.h - ((NUM_BARS - 1)*PADDING) - (NUM_BARS*HEIGHT)) / 2;    uint16_t width = bounds.size.w - (2 * PADDING); //this is 120 on basalt    //create the unary ticks image    s_unary_ticks_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_UNARY_TICKS);    s_unary_ticks_layer = bitmap_layer_create(GRect(PADDING,vert_padding,width + 1,HEIGHT));    bitmap_layer_set_background_color(s_unary_ticks_layer, GColorClear);    bitmap_layer_set_bitmap(s_unary_ticks_layer, s_unary_ticks_bitmap);    bitmap_layer_set_compositing_mode(s_unary_ticks_layer, GCompOpSet);    layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_unary_ticks_layer));    //create the ternary ticks image and layer for minutes    s_ternary_ticks_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_TERNARY_TICKS);    s_ternary_ticks_layer_minutes = bitmap_layer_create(GRect(PADDING, vert_padding + PADDING + HEIGHT, width + 1, HEIGHT));    bitmap_layer_set_background_color(s_ternary_ticks_layer_minutes, GColorClear);    bitmap_layer_set_bitmap(s_ternary_ticks_layer_minutes, s_ternary_ticks_bitmap);    bitmap_layer_set_compositing_mode(s_ternary_ticks_layer_minutes, GCompOpSet);    layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_ternary_ticks_layer_minutes));    //create the ternary ticks layer for seconds    s_ternary_ticks_layer_seconds = bitmap_layer_create(GRect(PADDING, vert_padding + (2*PADDING) + (2*HEIGHT), width + 1, HEIGHT));    bitmap_layer_set_background_color(s_ternary_ticks_layer_seconds, GColorClear);    bitmap_layer_set_bitmap(s_ternary_ticks_layer_seconds, s_ternary_ticks_bitmap);    bitmap_layer_set_compositing_mode(s_ternary_ticks_layer_seconds, GCompOpSet);    layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_ternary_ticks_layer_seconds));    if (persist_read_int(KEY_TOP_BAR_COLOR)) {        s_top_bar_color = GColorFromHEX(persist_read_int(KEY_TOP_BAR_COLOR));        ///	set_background_and_text_color(background_color);    } else {        s_top_bar_color = GColorRed;    }    if (persist_read_int(KEY_MIDDLE_BAR_COLOR)) {        s_middle_bar_color = GColorFromHEX(persist_read_int(KEY_MIDDLE_BAR_COLOR));    } else {        s_middle_bar_color = GColorGreen;    }    if (persist_read_int(KEY_BOTTOM_BAR_COLOR)) {        s_bottom_bar_color = GColorFromHEX(persist_read_int(KEY_BOTTOM_BAR_COLOR));    } else {        s_bottom_bar_color = GColorBlue;    }    if (persist_read_int(KEY_BACKGROUND_COLOR)) {        set_background_and_text_color(persist_read_int(KEY_BACKGROUND_COLOR));    } else {        set_background_and_text_color(0xFFFFFF);    }    if (persist_read_int(KEY_DEGREEOPTION)) {        degreeOption = persist_read_int(KEY_DEGREEOPTION);    } else {        degreeOption = 0;    }    s_weather_layer = text_layer_create(GRect(0,152, 144, 14));    text_layer_set_font(s_weather_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));    text_layer_set_background_color(s_weather_layer, GColorClear);    text_layer_set_text_color(s_weather_layer, gcolor_legible_over(background_color));    text_layer_set_text_alignment(s_weather_layer, GTextAlignmentRight);    text_layer_set_text(s_weather_layer, "Loading...");    layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_weather_layer));    s_bluetooth_icon_layer = layer_create(GRect(0,0,30,30));    layer_set_update_proc(s_bluetooth_icon_layer, bluetooth_update_proc);    bluetooth_path = gpath_create(&BLUETOOTH_INFO);    layer_add_child(window_get_root_layer(window), s_bluetooth_icon_layer);    //show the correct state of the bluetooth connection from the start#ifdef PBL_SDK_2    bluetooth_callback(bluetooth_connection_service_peek());#elif PBL_SDK_3    bluetooth_callback(connection_service_peek_pebble_app_connection());#endif    s_date_layer = text_layer_create(GRect(0,0,144,14));    text_layer_set_font(s_date_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));    text_layer_set_text_color(s_date_layer, gcolor_legible_over(background_color));    text_layer_set_background_color(s_date_layer, GColorClear);    text_layer_set_text_alignment(s_date_layer, GTextAlignmentRight);    layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_date_layer));}
开发者ID:Willdorf,项目名称:triplehorizontalbarwatchface,代码行数:93,


示例17: hands_update_proc

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);//.........这里部分代码省略.........
开发者ID:ygalanter,项目名称:Shadow_Analog,代码行数:101,


示例18: window_load

// Create the initial windowstatic void window_load(Window *window) {  Layer *window_layer = window_get_root_layer(window);  //GRect bounds = layer_get_bounds(window_layer);  text_layer = text_layer_create((GRect) { .origin = { 0, 0 }, .size = { /*bounds.size.w*/ 144, 168} });
开发者ID:Zyracksis,项目名称:WondrousPebble,代码行数:5,


示例19: initialise_ui

static void initialise_ui(void) {  s_window = window_create();  window_set_background_color(s_window, GColorBlack);  #ifndef PBL_SDK_3    window_set_fullscreen(s_window, 1);  #endif  s_res_bitham_30_black = fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD);  s_res_roboto_condensed_21 = fonts_get_system_font(FONT_KEY_ROBOTO_CONDENSED_21);  s_res_roboto_condensed_16 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_16));  // s_time_text_layer  s_time_text_layer = text_layer_create(GRect(0, 20, 144, 50));  text_layer_set_text(s_time_text_layer, "03:04");  text_layer_set_text_alignment(s_time_text_layer, GTextAlignmentCenter);  text_layer_set_font(s_time_text_layer, s_res_bitham_30_black);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_time_text_layer);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_time_text_layer);  // s_temperature_text_layer  s_temperature_text_layer = text_layer_create(GRect(10, 0, 110, 16));  text_layer_set_background_color(s_temperature_text_layer, GColorBlack);  text_layer_set_text_color(s_temperature_text_layer, GColorWhite);  text_layer_set_text(s_temperature_text_layer, "...");  //text_layer_set_text_alignment(s_temperature_text_layer, GTextAlignmentCenter);  text_layer_set_font(s_temperature_text_layer, s_res_roboto_condensed_16);;  layer_add_child(window_get_root_layer(s_window), (Layer *)s_temperature_text_layer);  // s_battery_textlayer  s_battery_textlayer = text_layer_create(GRect(110, 0, 30, 16));  text_layer_set_background_color(s_battery_textlayer, GColorBlack);  text_layer_set_text_color(s_battery_textlayer, GColorWhite);  text_layer_set_text(s_battery_textlayer, "...");  text_layer_set_font(s_battery_textlayer, s_res_roboto_condensed_16);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_battery_textlayer);  // s_date_layer  s_date_text_layer = text_layer_create(GRect(15, 67, 116, 25));  text_layer_set_text(s_date_text_layer, "00/00/0000");  text_layer_set_text_color(s_date_text_layer, GColorWhite);  text_layer_set_text_alignment(s_date_text_layer, GTextAlignmentCenter);  text_layer_set_font(s_date_text_layer, s_res_roboto_condensed_21);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_date_text_layer);  #ifndef PBL_SDK_2    text_layer_set_background_color(s_time_text_layer, GColorDarkCandyAppleRed);    text_layer_set_background_color(s_date_text_layer, GColorDarkCandyAppleRed);    text_layer_set_text_color(s_time_text_layer, GColorWhite);    #else    text_layer_set_background_color(s_time_text_layer, GColorWhite);    text_layer_set_background_color(s_date_text_layer, GColorWhite);  #endif      // Create battery meter Layer  s_battery_layer = layer_create(GRect(10, 0, 30, 10));  layer_set_update_proc(s_battery_layer, battery_update_proc);  // Add to Window  layer_add_child(window_get_root_layer(s_window), s_battery_layer);}
开发者ID:JeremyCarlsten,项目名称:BasicPebbleWatch,代码行数:61,


示例20: app_sync_init

  app_sync_init(&s_sync, s_sync_buffer, sizeof(s_sync_buffer), initial_values, ARRAY_LENGTH(initial_values), s_sync_tuple_changed_callback, NULL, NULL);      s_window = window_create();  window_set_window_handlers(s_window, (WindowHandlers) {    .load = window_load,    .unload = window_unload,  });  window_stack_push(s_window, true);  // Init hand paths  s_minute_arrow = gpath_create(&MINUTE_HAND_POINTS);  s_hour_arrow = gpath_create(&HOUR_HAND_POINTS);   Layer *window_layer = window_get_root_layer(s_window);  GRect bounds = layer_get_bounds(window_layer);  GPoint center = grect_center_point(&bounds);    gpath_move_to(s_minute_arrow, center);  gpath_move_to(s_hour_arrow, center);    if (strcmp(configs.secondhandoption, "off") == 0) {    tick_timer_service_subscribe(MINUTE_UNIT, handle_tick);  }  else if (strcmp(configs.secondhandoption, "quartz") == 0){    tick_timer_service_subscribe(SECOND_UNIT, handle_tick);  }  else if (strcmp(configs.secondhandoption, "stop2go") == 0){    tick_timer_service_subscribe(SECOND_UNIT, handle_tick);  }
开发者ID:joliva,项目名称:MondainePebbleWatchFace,代码行数:31,


示例21: npr_layer_create

void npr_layer_create(GRect frame, Window *window){  npr_layer = layer_create_with_data(frame, sizeof(NprLayerData));  NprLayerData *nld = layer_get_data(npr_layer);  nld->loading_layer = layer_create(GRect(47, 60, 50, 20));  layer_set_update_proc(nld->loading_layer, npr_animate_update);  layer_add_child(npr_layer, nld->loading_layer);  nld->primary_call_layer = text_layer_create(GRect(0, 0, 44, 20));  text_layer_set_text_color(nld->primary_call_layer, GColorWhite);  text_layer_set_background_color(nld->primary_call_layer, GColorClear);  text_layer_set_font(nld->primary_call_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));  text_layer_set_text_alignment(nld->primary_call_layer, GTextAlignmentLeft);  layer_add_child(npr_layer, text_layer_get_layer(nld->primary_call_layer));  nld->primary_frequency_layer = text_layer_create(GRect(0, 9, 110, 45));  text_layer_set_text_color(nld->primary_frequency_layer, GColorWhite);  text_layer_set_background_color(nld->primary_frequency_layer, GColorClear);  text_layer_set_font(nld->primary_frequency_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));  text_layer_set_text_alignment(nld->primary_frequency_layer, GTextAlignmentLeft);  layer_add_child(npr_layer, text_layer_get_layer(nld->primary_frequency_layer));  nld->primary_strength_layer = layer_create(GRect(104, 1, 44, 50));  layer_set_update_proc(nld->primary_strength_layer, primary_strength_layer_update);  layer_add_child(npr_layer, nld->primary_strength_layer);  nld->primary_program_layer = text_layer_create(GRect(0, 48, 144, 22));  text_layer_set_text_color(nld->primary_program_layer, GColorWhite);  text_layer_set_background_color(nld->primary_program_layer, GColorClear);  text_layer_set_font(nld->primary_program_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18));  text_layer_set_text_alignment(nld->primary_program_layer, GTextAlignmentRight);  layer_add_child(npr_layer, text_layer_get_layer(nld->primary_program_layer));  nld->secondary_call_layer = text_layer_create(GRect(0, 75, 44, 20));  text_layer_set_text_color(nld->secondary_call_layer, GColorWhite);  text_layer_set_background_color(nld->secondary_call_layer, GColorClear);  text_layer_set_font(nld->secondary_call_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));  text_layer_set_text_alignment(nld->secondary_call_layer, GTextAlignmentLeft);  layer_add_child(npr_layer, text_layer_get_layer(nld->secondary_call_layer));  nld->secondary_frequency_layer = text_layer_create(GRect(0, 84, 110, 45));  text_layer_set_text_color(nld->secondary_frequency_layer, GColorWhite);  text_layer_set_background_color(nld->secondary_frequency_layer, GColorClear);  text_layer_set_font(nld->secondary_frequency_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));  text_layer_set_text_alignment(nld->secondary_frequency_layer, GTextAlignmentLeft);  layer_add_child(npr_layer, text_layer_get_layer(nld->secondary_frequency_layer));  nld->secondary_strength_layer = layer_create(GRect(104, 76, 44, 50));  layer_set_update_proc(nld->secondary_strength_layer, secondary_strength_layer_update);  layer_add_child(npr_layer, nld->secondary_strength_layer);  nld->secondary_program_layer = text_layer_create(GRect(0, 124, 144, 22));  text_layer_set_text_color(nld->secondary_program_layer, GColorWhite);  text_layer_set_background_color(nld->secondary_program_layer, GColorClear);  text_layer_set_font(nld->secondary_program_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18));  text_layer_set_text_alignment(nld->secondary_program_layer, GTextAlignmentRight);  layer_add_child(npr_layer, text_layer_get_layer(nld->secondary_program_layer));  nld->error_icon = gbitmap_create_with_resource(RESOURCE_ID_ICON_ERROR);  nld->error_icon_layer = bitmap_layer_create(GRect(47, 42, 50, 50));  layer_add_child(npr_layer, bitmap_layer_get_layer(nld->error_icon_layer));  layer_set_hidden(bitmap_layer_get_layer(nld->error_icon_layer), true);  bitmap_layer_set_bitmap(nld->error_icon_layer, nld->error_icon);  layer_add_child(window_get_root_layer(window), npr_layer);}
开发者ID:jaredbiehler,项目名称:public-radio-finder,代码行数:68,


示例22: main_window_load

static void main_window_load(Window *window) {  s_menu_icon_image = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MENU_ICON_1);  int num_a_items = 0;  s_first_menu_items[num_a_items++] = (SimpleMenuItem) {    .title = "Dairy",    .callback = menu_select_callback,};  s_first_menu_items[num_a_items++] = (SimpleMenuItem) {    .title = "Fruits and Veggies",    .callback = menu_select_callback,  };  s_first_menu_items[num_a_items++] = (SimpleMenuItem) {    .title = "Meats and Fish",    .callback = menu_select_callback,  };   s_first_menu_items[num_a_items++] = (SimpleMenuItem) {    .title = "Grains",    .callback = menu_select_callback,  }; s_first_menu_items[num_a_items++] = (SimpleMenuItem) {    .title = "Misc.",    .callback = menu_select_callback,  };  s_menu_sections[0] = (SimpleMenuSection) {    .num_items = NUM_FIRST_MENU_ITEMS,    .items = s_first_menu_items,  };    Layer *window_layer = window_get_root_layer(window);  GRect bounds = layer_get_frame(window_layer);  s_simple_menu_layer = simple_menu_layer_create(bounds, window, s_menu_sections, NUM_MENU_SECTIONS, NULL);  layer_add_child(window_layer, simple_menu_layer_get_layer(s_simple_menu_layer));}void main_window_unload(Window *window) {  simple_menu_layer_destroy(s_simple_menu_layer);  gbitmap_destroy(s_menu_icon_image);}static void init() {  s_main_window = window_create();  window_set_window_handlers(s_main_window, (WindowHandlers) {    .load = main_window_load,    .unload = main_window_unload,  });}static void deinit() {  window_destroy(s_main_window);}int main(void) {  init();  products_init();  handle_init();  app_event_loop();  deinit();  products_deinit();  handle_deinit();}
开发者ID:amanmomin,项目名称:AssistList,代码行数:66,


示例23: window_load

static void window_load(Window *window) {     /*  //Setup BT Layer  bt_layer = text_layer_create(GRect(5, 5, 144, 30));  text_layer_set_font(bt_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18));  if(bluetooth_connection_service_peek() == true)  {    text_layer_set_text(bt_layer, "BT: CONNECTED");  }  else  {    text_layer_set_text(bt_layer, "BT: DISCONNECTED");  }  layer_add_child(window_get_root_layer(window), text_layer_get_layer(bt_layer));*/            // Although we already defined NUM_FIRST_MENU_ITEMS, you can define        // an int as such to easily change the order of menu items later        int num_a_items = 0;        // This is an example of how you'd set a simple menu item        first_menu_items[num_a_items++] = (SimpleMenuItem){        // You should give each menu item a title and callback        .title = "Chambre",        .subtitle = "Sélection",        .callback = menu_select_callback,        };        // The menu items appear in the order saved in the menu items array        first_menu_items[num_a_items++] = (SimpleMenuItem){        .title = "Cuisine",        // You can also give menu items a subtitle        .subtitle = "Sélection",        .callback = menu_select_callback,        };        first_menu_items[num_a_items++] = (SimpleMenuItem){        .title = "Bureau",        .subtitle = "Sélection",        .callback = menu_select_callback,        // This is how you would give a menu item an icon        //  .icon = menu_icon_image,        };        first_menu_items[num_a_items++] = (SimpleMenuItem){        // You should give each menu item a title and callback        .title = "Salle de bain",        .subtitle = "Sélection",        .callback = menu_select_callback,        };        first_menu_items[num_a_items++] = (SimpleMenuItem){        // You should give each menu item a title and callback        .title = "TV",        .subtitle = "Sélection",        .callback = menu_select_callback,        };        // This initializes the second section        second_menu_items[0] = (SimpleMenuItem){        .title = "Retour",        // You can use different callbacks for your menu items        .callback = special_select_callback,        };        // Bind the menu items to the corresponding menu sections        menu_sections[0] = (SimpleMenuSection){        .title = "Sélection des pièces",        .num_items = NUM_FIRST_MENU_ITEMS,        .items = first_menu_items,        };        menu_sections[1] = (SimpleMenuSection){        // Menu sections can also have titles as well        .title = "Fin de la sélection",        .num_items = NUM_SECOND_MENU_ITEMS,        .items = second_menu_items,        };// INITIALISATION WINDOW, MENU LAYER,...        // Now we prepare to initialize the simple menu layer        // We need the bounds to specify the simple menu layer's viewport size        // In this case, it'll be the same as the window's        Layer *window_layer = window_get_root_layer(window);        GRect bounds = layer_get_frame(window_layer);        // Initialize the simple menu layer        simple_menu_layer = simple_menu_layer_create(bounds, window, menu_sections, NUM_MENU_SECTIONS, NULL);        // Add it to the window for display        layer_add_child(window_layer, simple_menu_layer_get_layer(simple_menu_layer));        }// Deinitialize resources on window unload that were initialized on window load        void window_unload(Window *window) {        simple_menu_layer_destroy(simple_menu_layer);         // text_layer_destroy(bt_layer);        }//.........这里部分代码省略.........
开发者ID:swatchon,项目名称:Swatch-On---Part-2---Pebble,代码行数:101,


示例24: initialise_ui

static void initialise_ui(void) {      Fuente15 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_amano_20));  Fuente30 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_amano_30));  Fuente50 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_amano_40)); 	  // BLFondo  BLFondo = bitmap_layer_create(GRect(0, 0, 144, 168));  bitmap_layer_set_bitmap(BLFondo, gbitmap_create_with_resource(RESOURCE_ID_pizarra_WHITE));  //bitmap_layer_set_background_color(BLFondo, GColorWhite);  layer_add_child(window_get_root_layer(pwindow), (Layer *)BLFondo);      // TLHora  TLHora = text_layer_create(GRect(0, 10, 75, 70));  text_layer_set_background_color(TLHora, GColorClear);  text_layer_set_text_color(TLHora, GColorWhite);  text_layer_set_text(TLHora, "24");  text_layer_set_text_alignment(TLHora, GTextAlignmentCenter);  text_layer_set_font(TLHora, Fuente50);  layer_add_child(window_get_root_layer(pwindow), (Layer *)TLHora);    // TLMinuto  TLMinuto = text_layer_create(GRect(70, 8, 80, 70));  text_layer_set_text(TLMinuto, "59");  text_layer_set_background_color(TLMinuto, GColorClear);  text_layer_set_text_color(TLMinuto, GColorWhite);  text_layer_set_text_alignment(TLMinuto, GTextAlignmentCenter);  text_layer_set_font(TLMinuto, Fuente50);  layer_add_child(window_get_root_layer(pwindow), (Layer *)TLMinuto);    // TLDiaSem  TLDiaSem = text_layer_create(GRect(0, 120, 65, 60));  text_layer_set_background_color(TLDiaSem, GColorClear);  text_layer_set_text_color(TLDiaSem, GColorWhite);  text_layer_set_text(TLDiaSem, "ma");  text_layer_set_text_alignment(TLDiaSem, GTextAlignmentCenter);  text_layer_set_font(TLDiaSem, Fuente30);  layer_add_child(window_get_root_layer(pwindow), (Layer *)TLDiaSem);    // TLDia  TLDia = text_layer_create(GRect(58, 70, 60, 60));  text_layer_set_background_color(TLDia, GColorClear);  text_layer_set_text_color(TLDia, GColorWhite);  text_layer_set_text(TLDia, "30");  text_layer_set_text_alignment(TLDia, GTextAlignmentCenter);  text_layer_set_font(TLDia, Fuente30);  layer_add_child(window_get_root_layer(pwindow), (Layer *)TLDia);    // TLMes  TLMes = text_layer_create(GRect(50, 110, 90, 52));  text_layer_set_background_color(TLMes, GColorClear);  text_layer_set_text_color(TLMes, GColorWhite);  text_layer_set_text(TLMes, "08");  text_layer_set_text_alignment(TLMes, GTextAlignmentCenter);  text_layer_set_font(TLMes, Fuente30);  layer_add_child(window_get_root_layer(pwindow), (Layer *)TLMes);      //ILFondo  //Comprueba configuración  inverted = persist_read_bool(KEY_INVERT);  idioma = persist_read_int(KEY_IDIOMA);  ILFondo = inverter_layer_create(GRect(0, 0, 144, 168));  layer_add_child(window_get_root_layer(pwindow), (Layer *)ILFondo);	  //Option-specific setup  if(inverted == true)  {     layer_set_hidden((Layer *)ILFondo, false);  }  else  {     layer_set_hidden((Layer *)ILFondo, true);  }      // TLBateria  TLBateria = text_layer_create(GRect(115, 70, 40, 30));  text_layer_set_background_color(TLBateria, GColorClear);  text_layer_set_text_color(TLBateria, GColorWhite);  text_layer_set_text(TLBateria, "100");  text_layer_set_font(TLBateria, Fuente15);  text_layer_set_text_alignment(TLBateria, GTextAlignmentCenter);  layer_add_child(window_get_root_layer(pwindow), (Layer *)TLBateria);	}
开发者ID:manelto,项目名称:pizarra,代码行数:89,


示例25: in_received_handler

static void in_received_handler(DictionaryIterator *iter, void *context) {  autoconfig_in_received_handler(iter, context);  layer_set_hidden(inverter_layer_get_layer(inverter_layer),!getInvert());  layer_mark_dirty(window_get_root_layer(window));  handle_battery(battery_state_service_peek());}
开发者ID:reini1305,项目名称:pastpresentfuture,代码行数:6,


示例26: init

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)),//.........这里部分代码省略.........
开发者ID:mereed,项目名称:pebbleface-tiktocdigital,代码行数:101,


示例27: main_window_load

static void main_window_load(Window *window) {  //bg_color = GColorGreen;  #define bg_color GColorBlack          hour_layer = text_layer_create(GRect(-10,-15,94, 75));  min_layer = text_layer_create(GRect(66,60,85,85));  text_layer_set_text_color(hour_layer, COLOR_FALLBACK(GColorGreen, GColorWhite));  text_layer_set_text_color(min_layer, COLOR_FALLBACK(GColorGreen, GColorWhite));    text_layer_set_background_color(hour_layer, bg_color);    text_layer_set_background_color(min_layer, bg_color);      s_bg_layer = text_layer_create(GRect(0,0,144,168));  text_layer_set_background_color(s_bg_layer, COLOR_FALLBACK(GColorBlack, GColorBlack));  s_time_layer = text_layer_create(GRect(0,94,144,74));//0, 133, 115, 35));  am_layer = text_layer_create(GRect(125, 150, 19, 18));  battery_text_layer = text_layer_create(GRect(0, 150, 144, 20));    date_layer = text_layer_create(GRect(70 ,0, 74, 70));    s_battery_layer = text_layer_create(GRect(0, 160, 125, 20));      condition_layer = text_layer_create(GRect(0, 70, 70, 28));  //85 px tall  temp_layer = text_layer_create(GRect(0, 90, 70, 28));  city_layer = text_layer_create(GRect(0, 112, 70, 28));    no_phone_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_NO_PHONE);  no_phone_layer = bitmap_layer_create(GRect(0, 80, 60, 70));  bitmap_layer_set_bitmap(no_phone_layer, no_phone_bitmap);  bitmap_layer_set_background_color(no_phone_layer, COLOR_FALLBACK(GColorCyan, GColorWhite));  layer_set_hidden(bitmap_layer_get_layer(no_phone_layer), true);  bt_handler(bluetooth_connection_service_peek());    ///text_layer_set_text_color(s_battery_layer, COLOR_FALLBACK(GColorWhite, GColorWhite));  text_layer_set_background_color(s_time_layer, COLOR_FALLBACK(bg_color, GColorBlack));  text_layer_set_background_color(am_layer, COLOR_FALLBACK(GColorClear, GColorBlack));  text_layer_set_background_color(battery_text_layer, COLOR_FALLBACK(GColorClear, GColorClear));  //battery layer  text_layer_set_background_color(s_battery_layer, COLOR_FALLBACK(GColorGreen, GColorWhite));  text_layer_set_background_color(condition_layer, COLOR_FALLBACK(GColorCyan, GColorWhite));  text_layer_set_background_color(temp_layer, COLOR_FALLBACK(GColorCyan, GColorWhite));  text_layer_set_background_color(city_layer, COLOR_FALLBACK(GColorCyan, GColorWhite));  text_layer_set_text_color(condition_layer, COLOR_FALLBACK(GColorBlack, GColorBlack));  text_layer_set_text_color(temp_layer, COLOR_FALLBACK(GColorBlack, GColorBlack));  text_layer_set_text_color(city_layer, COLOR_FALLBACK(GColorBlack, GColorBlack));  text_layer_set_text_color(battery_text_layer, COLOR_FALLBACK(GColorOrange, GColorWhite));    text_layer_set_background_color(date_layer, COLOR_FALLBACK(GColorOrange, GColorWhite));  text_layer_set_text_color(date_layer, COLOR_FALLBACK(GColorBlack, GColorBlack));  text_layer_set_text_color(am_layer, COLOR_FALLBACK(GColorRed, GColorWhite));  text_layer_set_text_color(s_time_layer, COLOR_FALLBACK(GColorGreen, GColorWhite));  text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);  text_layer_set_text_alignment(date_layer, GTextAlignmentCenter);  text_layer_set_text_alignment(battery_text_layer, GTextAlignmentCenter);    text_layer_set_text_alignment(condition_layer, GTextAlignmentCenter);  text_layer_set_text_alignment(temp_layer, GTextAlignmentCenter);  text_layer_set_text_alignment(city_layer, GTextAlignmentCenter);      text_layer_set_text(s_time_layer, "  :  ");  s_custom_font_24 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_CHAMPAGNE_72));  s_custom_font_18 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_CHAMPAGNE_20));//DS_DIGI_18));  s_custom_font_12 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_CHAMPAGNE_12));  text_layer_set_font(s_time_layer, s_custom_font_24); //fonts_get_system_font(FONT_KEY_BITHAM_30_BLACK));  text_layer_set_font(date_layer, s_custom_font_18);  text_layer_set_font(hour_layer, s_custom_font_24);  text_layer_set_font(min_layer, s_custom_font_24);  text_layer_set_font(condition_layer, s_custom_font_18);  text_layer_set_font(temp_layer, s_custom_font_18);  text_layer_set_font(city_layer, s_custom_font_12);  layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_bg_layer));  //text_layer_set_font(s_battery_layer, s_custom_font_18);   //layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_time_layer));    layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_battery_layer));  //layer_add_child(window_get_root_layer(window), text_layer_get_layer(am_layer));  layer_add_child(window_get_root_layer(window), text_layer_get_layer(hour_layer));  layer_add_child(window_get_root_layer(window), text_layer_get_layer(min_layer));  layer_add_child(window_get_root_layer(window), text_layer_get_layer(date_layer));  layer_add_child(window_get_root_layer(window), text_layer_get_layer(condition_layer));  layer_add_child(window_get_root_layer(window), text_layer_get_layer(temp_layer));  layer_add_child(window_get_root_layer(window), text_layer_get_layer(city_layer));  layer_add_child(window_get_root_layer(window), text_layer_get_layer(battery_text_layer));  layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(no_phone_layer));      Tuplet initial_values[] = {    //TupletInteger(WEATHER_ICON_KEY, (uint8_t) 1),    TupletCString(WEATHER_TEMPERATURE_KEY, ""),    TupletCString(WEATHER_CITY_KEY, ""),    TupletCString(WEATHER_CONDITION_KEY, "Loading")  };//.........这里部分代码省略.........
开发者ID:iamjoshwilson,项目名称:Digital_Champagne,代码行数:101,


示例28: minutes_layer_init

void minutes_layer_init(Window *window){	minutes_layer = layer_create(GRect(0, 0, 144, 168));	layer_set_update_proc(minutes_layer, minutes_proc);	layer_add_child(window_get_root_layer(window), minutes_layer);}
开发者ID:edwinfinch,项目名称:scatter,代码行数:5,


示例29: handle_window_load

static void handle_window_load(Window *window) {  Layer *window_layer = window_get_root_layer(window);  GRect bounds = layer_get_bounds(window_layer);  tl_current_time = text_layer_create_default((GRect) { .origin = { 0, 10 }, .size = { bounds.size.w, 50 } });
开发者ID:pshah123,项目名称:classyclock,代码行数:5,


示例30: initialise_ui

static void initialise_ui(void) {  LOG_FUNC();  s_window = window_create();  window_set_background_color(s_window, GColorClear);    s_res_image_background = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BACKGROUND);  s_res_image_bt_active = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BT_ACTIVE);  s_res_image_bt_passive = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BT_PASSIVE);  s_res_image_battery = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BATTERY);  s_res_image_outbound = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_OUTBOUND);  s_res_image_inbound = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_INBOUND);  s_res_roboto_condensed_21 = fonts_get_system_font(FONT_KEY_ROBOTO_CONDENSED_21);  s_res_bitham_42_medium_numbers = fonts_get_system_font(FONT_KEY_BITHAM_42_MEDIUM_NUMBERS);  s_res_gothic_18 = fonts_get_system_font(FONT_KEY_GOTHIC_24);  // s_bitmaplayer_bg  s_bitmaplayer_bg = bitmap_layer_create(GRect(0, 0, 144, 168));  bitmap_layer_set_bitmap(s_bitmaplayer_bg, s_res_image_background);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_bitmaplayer_bg);    // s_timelayer  s_timelayer = text_layer_create(GRect(5, 13, 134, 50));  text_layer_set_background_color(s_timelayer, GColorClear);  text_layer_set_text_color(s_timelayer, GColorWhite);  text_layer_set_text(s_timelayer, "00:00");  text_layer_set_text_alignment(s_timelayer, GTextAlignmentCenter);  text_layer_set_font(s_timelayer, s_res_bitham_42_medium_numbers);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_timelayer);    // s_daylayer  s_daylayer = text_layer_create(GRect(5, 64, 134, 26));  text_layer_set_background_color(s_daylayer, GColorClear);  text_layer_set_text_color(s_daylayer, GColorWhite);  text_layer_set_text(s_daylayer, "Mon");  text_layer_set_text_alignment(s_daylayer, GTextAlignmentCenter);  text_layer_set_font(s_daylayer, s_res_roboto_condensed_21);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_daylayer);  layer_set_hidden(text_layer_get_layer(s_daylayer), true);    // s_datelayer  s_datelayer = text_layer_create(GRect(5, 64, 134, 26));  text_layer_set_background_color(s_datelayer, GColorClear);  text_layer_set_text_color(s_datelayer, GColorWhite);  text_layer_set_text(s_datelayer, "2.5.2015");  text_layer_set_text_alignment(s_datelayer, GTextAlignmentCenter);  text_layer_set_font(s_datelayer, s_res_roboto_condensed_21);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_datelayer);    // s_bitmaplayer_outbound  s_bitmaplayer_outbound = bitmap_layer_create(GRect(5, 110, 14, 14));  bitmap_layer_set_bitmap(s_bitmaplayer_outbound, s_res_image_outbound);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_bitmaplayer_outbound);    // s_outboundlayer  s_outboundlayer = text_layer_create(GRect(24, 100, 115, 26));  text_layer_set_background_color(s_outboundlayer, GColorClear);  text_layer_set_text_color(s_outboundlayer, GColorWhite);  text_layer_set_text(s_outboundlayer, "Text layer");  text_layer_set_font(s_outboundlayer, s_res_gothic_18);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_outboundlayer);    // s_bitmaplayer_inbound  s_bitmaplayer_inbound = bitmap_layer_create(GRect(5, 135, 14, 14));  bitmap_layer_set_bitmap(s_bitmaplayer_inbound, s_res_image_inbound);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_bitmaplayer_inbound);    // s_inboundlayer  s_inboundlayer = text_layer_create(GRect(24, 125, 115, 26));  text_layer_set_background_color(s_inboundlayer, GColorClear);  text_layer_set_text_color(s_inboundlayer, GColorWhite);  text_layer_set_text(s_inboundlayer, "Text layer");  text_layer_set_font(s_inboundlayer, s_res_gothic_18);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_inboundlayer);  // s_bitmaplayer_bt  s_bitmaplayer_bt = bitmap_layer_create(GRect(125, 110, 14, 14));  layer_add_child(window_get_root_layer(s_window), (Layer *)s_bitmaplayer_bt);    // s_btlayer  s_btlayer = text_layer_create(GRect(5, 100, 115, 26));  text_layer_set_background_color(s_btlayer, GColorClear);  text_layer_set_text_color(s_btlayer, GColorWhite);  text_layer_set_text(s_btlayer, "Text layer");  text_layer_set_font(s_btlayer, s_res_gothic_18);  text_layer_set_text_alignment(s_btlayer, GTextAlignmentRight);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_btlayer);    // s_bitmaplayer_battery  s_bitmaplayer_battery = bitmap_layer_create(GRect(125, 135, 14, 14));  bitmap_layer_set_bitmap(s_bitmaplayer_battery, s_res_image_battery);  layer_add_child(window_get_root_layer(s_window), (Layer *)s_bitmaplayer_battery);    // s_batterylayer  s_batterylayer = text_layer_create(GRect(5, 125, 115, 26));  text_layer_set_background_color(s_batterylayer, GColorClear);  text_layer_set_text_color(s_batterylayer, GColorWhite);  text_layer_set_text(s_batterylayer, "Text layer");  text_layer_set_font(s_batterylayer, s_res_gothic_18);  text_layer_set_text_alignment(s_batterylayer, GTextAlignmentRight);//.........这里部分代码省略.........
开发者ID:astifter,项目名称:BetteryWatch,代码行数:101,



注:本文中的window_get_root_layer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ window_init函数代码示例
C++ window_find_by_class函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。