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

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

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

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

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

示例1: load_cb

/*: * Handle window loading. */static void load_cb(Window *window) {	// Right Margin	static int m = 4;	// Font Size	static int s = 31;	// First Row Offset	static int o = 0;	// Row Top Padding	static int p = 2;	// Screen Size	static int w = 144;	static int h = 168;	// Load resources we'll have to destroy later.	s_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TARGA_MS_31));	// NO DESCENDERS FOR YOU#define make_row(x) text_layer_create(GRect(m, (x - 1) * (s + p) + o, w, s))	// Window Background	//	s_bg_layer = bitmap_layer_create(GRect(0, 0, w, h));	bitmap_layer_set_background_color(s_bg_layer, GColorBlack);	layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_bg_layer));	s_cldr_layer = make_row(1);	text_layer_set_background_color(s_cldr_layer, GColorClear);	text_layer_set_text_color(s_cldr_layer, theme_tertiary);	text_layer_set_font(s_cldr_layer, s_font);	text_layer_set_text_alignment(s_cldr_layer, GTextAlignmentLeft);	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_cldr_layer));	s_date_layer = make_row(2);	text_layer_set_background_color(s_date_layer, GColorClear);	text_layer_set_text_color(s_date_layer, theme_secondary);	text_layer_set_font(s_date_layer, s_font);	text_layer_set_text_alignment(s_date_layer, GTextAlignmentLeft);	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_date_layer));	s_time_layer = make_row(3);	text_layer_set_background_color(s_time_layer, GColorClear);	text_layer_set_text_color(s_time_layer, theme_primary);	text_layer_set_font(s_time_layer, s_font);	text_layer_set_text_alignment(s_time_layer, GTextAlignmentLeft);	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_time_layer));	s_wthr_layer = make_row(4);	text_layer_set_background_color(s_wthr_layer, GColorClear);	text_layer_set_text_color(s_wthr_layer, theme_info);	text_layer_set_font(s_wthr_layer, s_font);	text_layer_set_text_alignment(s_wthr_layer, GTextAlignmentLeft);	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_wthr_layer));	s_blth_layer = make_row(5);	text_layer_set_background_color(s_blth_layer, GColorClear);	text_layer_set_text_color(s_blth_layer, theme_tertiary);	text_layer_set_font(s_blth_layer, s_font);	text_layer_set_text_alignment(s_blth_layer, GTextAlignmentLeft);	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_blth_layer));	s_batt_layer = make_row(5);	text_layer_set_background_color(s_batt_layer, GColorClear);	text_layer_set_text_color(s_batt_layer, theme_tertiary);	text_layer_set_font(s_batt_layer, s_font);	text_layer_set_text_alignment(s_batt_layer, GTextAlignmentLeft);	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_batt_layer));#undef make_row}
开发者ID:musl,项目名称:DataFace,代码行数:75,


示例2: handle_init

void handle_init(AppContextRef ctx) {  (void)ctx;  window_init(&window, "Brains Watch");  window_stack_push(&window, true);  resource_init_current_app(&APP_RESOURCES);//    rotbmp_pair_init_container(RESOURCE_ID_IMAGE_PANDA_WHITE, RESOURCE_ID_IMAGE_PANDA_BLACK, &bitmap_container);  // Set up a layer for the static watch face background  bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image_container);  layer_add_child(&window.layer, &background_image_container.layer.layer);dice = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_VISITOR_16));  text_layer_init(&date_layer, GRect(53, 105, 40, 40));  text_layer_set_text_alignment(&date_layer, GTextAlignmentCenter);  text_layer_set_text_color(&date_layer, GColorWhite);  text_layer_set_background_color(&date_layer, GColorClear);  text_layer_set_font(&date_layer, dice);  layer_add_child(&window.layer, &date_layer.layer); PblTm ti; get_time(&ti);   string_format_time(date_text, sizeof(date_text), "%d", &ti); text_layer_set_text(&date_layer, date_text);  // Set up a layer for the hour hand  rotbmp_init_container(RESOURCE_ID_IMAGE_HOUR_HAND, &hour_hand_image_container);    //  hour_hand_image_container.layer.compositing_mode = GCompOpClear;  rot_bitmap_set_src_ic(&hour_hand_image_container.layer, GPoint(3, 42));  layer_add_child(&window.layer, &hour_hand_image_container.layer.layer);  // Set up a layer for the minute hand  rotbmp_init_container(RESOURCE_ID_IMAGE_MINUTE_HAND, &minute_hand_image_container); // minute_hand_image_container.layer.compositing_mode = GCompOpClear;  rot_bitmap_set_src_ic(&minute_hand_image_container.layer, GPoint(3, 58));  layer_add_child(&window.layer, &minute_hand_image_container.layer.layer);  update_hand_positions();  // Setup the black and white circle in the centre of the watch face  // (We use a bitmap rather than just drawing it because it means not having  // to stuff around with working out the circle center etc.)  rotbmp_pair_init_container(RESOURCE_ID_IMAGE_CENTER_CIRCLE_WHITE, RESOURCE_ID_IMAGE_CENTER_CIRCLE_BLACK,			     &center_circle_image_container);  // TODO: Do this properly with a GRect().  // (144 = screen width, 168 = screen height)  center_circle_image_container.layer.layer.frame.origin.x = (144/2) - (center_circle_image_container.layer.layer.frame.size.w/2);  center_circle_image_container.layer.layer.frame.origin.y = (168/2) - (center_circle_image_container.layer.layer.frame.size.h/2);  layer_add_child(&window.layer, &center_circle_image_container.layer.layer);  layer_init(&second_display_layer, window.layer.frame);  second_display_layer.update_proc = &second_display_layer_update_callback;  layer_add_child(&window.layer, &second_display_layer);}
开发者ID:CupricWolf,项目名称:Gatekeeper,代码行数:80,


示例3: mainWindowLoad

/** * Window load handler function */static void mainWindowLoad(Window *w){  init_hardware_icons();    // Get information about the root window  Layer *windowLayer = window_get_root_layer(w);  GRect bounds = layer_get_bounds(windowLayer);    // Set sleepy time flag  time_t temp_time = time(NULL);  struct tm *cur_time = localtime(&temp_time);   s_is_sleepy_time = (cur_time->tm_hour <= SLEEPY_TIME_END_HOUR && cur_time->tm_hour >= SLEEPY_TIME_START_HOUR);    //////////////////////////////////////////  // Battery    GRect bat_icon_bounds = get_battery_icon_bounds();    // Create BitmapLayer to display the GBitmap  s_powerIconLayer = bitmap_layer_create(GRect(bounds.size.w - (bat_icon_bounds.size.w + 2),                                               0, bat_icon_bounds.size.w, bat_icon_bounds.size.h));  // set background colout and compositing mode   bitmap_layer_set_background_color(s_powerIconLayer, POWER_ICON_BACK_COLOR);  bitmap_layer_set_compositing_mode(s_powerIconLayer, GCompOpSet);    update_power_status(battery_state_service_peek());    // add the bitmap layer to the window  layer_add_child(windowLayer, bitmap_layer_get_layer(s_powerIconLayer));    //////////////////////////////////////////  // BT connection  GRect bt_icon_bounds = get_bt_icon_bounds();    // Create BitmapLayer to display the GBitmap  s_btIconLayer = bitmap_layer_create(GRect(bounds.size.w - (bat_icon_bounds.size.w + bt_icon_bounds.size.w + 4), 4, bt_icon_bounds.size.w, bt_icon_bounds.size.h));  // set background colout and compositing mode   bitmap_layer_set_background_color(s_btIconLayer, BT_ICON_BACK_COLOR);  bitmap_layer_set_compositing_mode(s_btIconLayer, GCompOpSet);    update_bt_status(connection_service_peek_pebble_app_connection());    // add the bitmap layer to the window  layer_add_child(windowLayer, bitmap_layer_get_layer(s_btIconLayer));    ////////////////////////////////////  // Create the time text layers    // time accuracy text layer  s_timeAccText = text_layer_create(GRect(2, PBL_IF_ROUND_ELSE(-2, -6), 94, 28));    // Improve the layout to be more like a watchface  text_layer_set_background_color(s_timeAccText, TIME_TEXT_BACK_COLOR);  text_layer_set_text_color(s_timeAccText, (s_is_sleepy_time ? TIME_TEXT_FORE_COLOR_NIGHT : TIME_TEXT_FORE_COLOR_DAY));    //s_timeFont = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_FFF_TUSJ_42));  GFont timeFont = fonts_get_system_font(FONT_KEY_GOTHIC_24);    text_layer_set_font(s_timeAccText, timeFont);  text_layer_set_text_alignment(s_timeAccText, GTextAlignmentLeft);  // Add it as a child layer to the Window's root layer  layer_add_child(windowLayer, text_layer_get_layer(s_timeAccText));      // time text layer  s_timeText = text_layer_create(GRect(2, PBL_IF_ROUND_ELSE(20, 16), bounds.size.w-4, 100));    // Improve the layout to be more like a watchface  text_layer_set_background_color(s_timeText, TIME_TEXT_BACK_COLOR);  text_layer_set_text_color(s_timeText, (s_is_sleepy_time ? TIME_TEXT_FORE_COLOR_NIGHT : TIME_TEXT_FORE_COLOR_DAY));  update_timeish(s_timeText,s_timeAccText);    //s_timeFont = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_FFF_TUSJ_42));  timeFont = fonts_get_system_font(FONT_KEY_BITHAM_30_BLACK);    text_layer_set_font(s_timeText, timeFont);  text_layer_set_text_alignment(s_timeText, GTextAlignmentLeft);  // Add it as a child layer to the Window's root layer  layer_add_child(windowLayer, text_layer_get_layer(s_timeText));    ///////////////////////////////////  // Create the date text layer  s_dateText = text_layer_create(GRect(2, PBL_IF_ROUND_ELSE(128, 122), bounds.size.w-4, 16));     // Improve the layout to be more like a watchface  text_layer_set_background_color(s_dateText, TIME_TEXT_BACK_COLOR);  text_layer_set_text_color(s_dateText, (s_is_sleepy_time ? TIME_TEXT_FORE_COLOR_NIGHT : TIME_TEXT_FORE_COLOR_DAY));  update_date(s_dateText);    //s_dateFont = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_FFF_TUSJ_24));  GFont dateFont = fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD);//.........这里部分代码省略.........
开发者ID:nigelatkinson,项目名称:pebble-watchface-tutorial,代码行数:101,


示例4: window_load

void window_load(Window *window) {    persist_read_string(1, saved_passcode, 50);        Layer *window_layer = window_get_root_layer(window);        number_0 = number_layer_init(GRect(124, 0, 20, 15), "0");    layer_add_child(window_layer, text_layer_get_layer(number_0));        number_1 = number_layer_init(GRect(124, 15, 20, 15), "1");    layer_add_child(window_layer, text_layer_get_layer(number_1));        number_2 = number_layer_init(GRect(124, 30, 20, 15), "2");    layer_add_child(window_layer, text_layer_get_layer(number_2));        number_3 = number_layer_init(GRect(124, 45, 20, 15), "3");    layer_add_child(window_layer, text_layer_get_layer(number_3));        number_4 = number_layer_init(GRect(124, 60, 20, 15), "4");    layer_add_child(window_layer, text_layer_get_layer(number_4));        number_5 = number_layer_init(GRect(124, 75, 20, 15), "5");    layer_add_child(window_layer, text_layer_get_layer(number_5));        number_6 = number_layer_init(GRect(124, 90, 20, 15), "6");    layer_add_child(window_layer, text_layer_get_layer(number_6));        number_7 = number_layer_init(GRect(124, 105, 20, 15), "7");    layer_add_child(window_layer, text_layer_get_layer(number_7));        number_8 = number_layer_init(GRect(124, 120, 20, 15), "8");    layer_add_child(window_layer, text_layer_get_layer(number_8));        number_9 = number_layer_init(GRect(124, 135, 20, 17), "9");    layer_add_child(window_layer, text_layer_get_layer(number_9));        status_text_layer = text_layer_create(GRect(0, 90, 124, 40));    text_layer_set_text_color(status_text_layer, GColorBlack);    text_layer_set_font(status_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18));    text_layer_set_text_alignment(status_text_layer, GTextAlignmentCenter);    layer_add_child(window_get_root_layer(window), text_layer_get_layer(status_text_layer));        selected_number = 0;    cursor_position = 0;        circle_layer = layer_create(GRect(0, 20, 144, 100));    layer_set_update_proc(circle_layer, circle_proc);    layer_add_child(window_layer, circle_layer);        update_bar();        window_set_click_config_provider(window, (ClickConfigProvider) config_provider);        line = gbitmap_create_with_resource(RESOURCE_ID_LINE);        line_layer = bitmap_layer_create(GRect(122, 0, 2, 168));    bitmap_layer_set_alignment(line_layer, GAlignCenter);    layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(line_layer));        bitmap_layer_set_bitmap(line_layer, line);        theme = inverter_layer_create(GRect(0, 0, 144, 168));    layer_add_child(window_layer, inverter_layer_get_layer(theme));    layer_set_hidden(inverter_layer_get_layer(theme), theme_public);}
开发者ID:BalestraPatrick,项目名称:PebblePasscodeWindow,代码行数:64,


示例5: improve_text_layer

static void improve_text_layer(TextLayer *the_text_layer, GFont font) {  text_layer_set_font(the_text_layer, font);  text_layer_set_text_alignment(the_text_layer, GTextAlignmentCenter);}
开发者ID:Marrrrrrk,项目名称:PebbleWatchface,代码行数:4,


示例6: handle_init

static void handle_init(AppContextRef ctx) {	(void)ctx;	window_init(&s_data.window, "MichaPoe words #1");	window_stack_push(&s_data.window, true);	resource_init_current_app(&WF_WOERTER_2);	// resolution: 144 × 168	// Fonts	GFont font_gross = fonts_load_custom_font(resource_get_handle(DATEFONTBIG));	GFont font_mittel = fonts_load_custom_font(resource_get_handle(DATEFONTMIDDLE));	GFont font_klein = fonts_load_custom_font(resource_get_handle(DATEFONTSMALL));	GFont font_minute = font_mittel;	GFont font_qualifier = font_klein;	GFont font_hour = font_gross;	GFont font_daytime = font_klein;	// init layers	layer_init(&s_data.simple_bg_layer, s_data.window.layer.frame);	s_data.simple_bg_layer.update_proc = &bg_update_proc;	layer_add_child(&s_data.window.layer, &s_data.simple_bg_layer);	// init date layer -> a plain parent layer to create a date update proc	layer_init(&s_data.date_layer, s_data.window.layer.frame);	s_data.date_layer.update_proc = &date_update_proc;	layer_add_child(&s_data.window.layer, &s_data.date_layer);	// calc top of frames	int16_t top = TOPSPACE;	s_data.minute_label_top = top;	s_data.qualifier_label_top = top += TEXTLAYER_MINUTE_VSPACE + FONT_MINUTE_SIZE;	s_data.hourqualifier_label_top = top += TEXTLAYER_QUALIFIER_VSPACE + FONT_QUALIFIER_SIZE;	s_data.hour_label_top = top += TEXTLAYER_QUALIFIER_VSPACE + FONT_QUALIFIER_SIZE;	s_data.daytime_label_top = top += TEXTLAYER_HOUR_VSPACE + FONT_HOUR_SIZE;	top += TEXTLAYER_DAYTIME_VSPACE + FONT_DAYTIME_SIZE;	int16_t move_down = (168 - top) / 2;	s_data.minute_label_top += move_down;	s_data.qualifier_label_top += move_down;	s_data.hourqualifier_label_top += move_down;	s_data.hour_label_top += move_down;	s_data.daytime_label_top += move_down;	// init minute	text_layer_init(&s_data.minute_label, GRect(LEFTSPACE, s_data.minute_label_top, TEXTLAYERWIDTH, FONT_MINUTE_SIZE + TEXTLAYER_MINUTE_VSPACE));	text_layer_set_text(&s_data.minute_label, s_data.minute_buffer);	text_layer_set_background_color(&s_data.minute_label, GColorBlack);	text_layer_set_text_color(&s_data.minute_label, GColorWhite);	text_layer_set_font(&s_data.minute_label, font_minute);	layer_add_child(&s_data.date_layer, &s_data.minute_label.layer);	// init qualifier	text_layer_init(&s_data.qualifier_label, GRect(LEFTSPACE, s_data.qualifier_label_top, TEXTLAYERWIDTH, FONT_QUALIFIER_SIZE + TEXTLAYER_QUALIFIER_VSPACE));	text_layer_set_text(&s_data.qualifier_label, s_data.qualifier_buffer);	text_layer_set_background_color(&s_data.qualifier_label, GColorBlack);	text_layer_set_text_color(&s_data.qualifier_label, GColorWhite);	text_layer_set_font(&s_data.qualifier_label, font_qualifier);	layer_add_child(&s_data.date_layer, &s_data.qualifier_label.layer);	// init hourqualifier	text_layer_init(&s_data.hourqualifier_label, GRect(LEFTSPACE, s_data.hourqualifier_label_top, TEXTLAYERWIDTH, FONT_QUALIFIER_SIZE + TEXTLAYER_QUALIFIER_VSPACE));	text_layer_set_text(&s_data.hourqualifier_label, s_data.hourqualifier_buffer);	text_layer_set_background_color(&s_data.hourqualifier_label, GColorBlack);	text_layer_set_text_color(&s_data.hourqualifier_label, GColorWhite);	text_layer_set_font(&s_data.hourqualifier_label, font_qualifier);	layer_add_child(&s_data.date_layer, &s_data.hourqualifier_label.layer);	// init hour	text_layer_init(&s_data.hour_label, GRect(LEFTSPACE, s_data.hour_label_top, TEXTLAYERWIDTH, FONT_HOUR_SIZE + TEXTLAYER_HOUR_VSPACE));	text_layer_set_text(&s_data.hour_label, s_data.hour_buffer);	text_layer_set_background_color(&s_data.hour_label, GColorBlack);	text_layer_set_text_color(&s_data.hour_label, GColorWhite);	text_layer_set_font(&s_data.hour_label, font_hour);	layer_add_child(&s_data.date_layer, &s_data.hour_label.layer);	// init daytime	text_layer_init(&s_data.daytime_label, GRect(LEFTSPACE, s_data.daytime_label_top, TEXTLAYERWIDTH, FONT_DAYTIME_SIZE + TEXTLAYER_DAYTIME_VSPACE));	text_layer_set_text(&s_data.daytime_label, s_data.daytime_buffer);	text_layer_set_background_color(&s_data.daytime_label, GColorBlack);	text_layer_set_text_color(&s_data.daytime_label, GColorWhite);	text_layer_set_font(&s_data.daytime_label, font_daytime);	layer_add_child(&s_data.date_layer, &s_data.daytime_label.layer);}
开发者ID:MichaPoe,项目名称:wf_woerter_2,代码行数:84,


示例7: init

static void init(void) {	window = window_create();	window_stack_push(window, true);	window_set_background_color(window, GColorBlack);	Layer *root_layer = window_get_root_layer(window);	GRect frame = layer_get_frame(root_layer);	// Init fonts and images	font			=	fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_16));	font_tiny		=	fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_10));	battery_outline	=	gbitmap_create_with_resource(RESOURCE_ID_BATTERY_OUTLINE);	battery_charge	=	gbitmap_create_with_resource(RESOURCE_ID_BATTERY_CHARGE);	// Init layer for display	display_layer = layer_create(frame);	layer_set_update_proc(display_layer, &display_layer_update_callback);	layer_add_child(root_layer, display_layer);	// Init layer for text	date_layer = text_layer_create(frame);	layer_set_frame(text_layer_get_layer(date_layer), GRect(0, 130, 144, 168-130));	layer_set_bounds(text_layer_get_layer(date_layer), GRect(0, 0, 144, 168-130));	text_layer_set_text_alignment(date_layer, GTextAlignmentCenter);	text_layer_set_font(date_layer, font);	layer_add_child(root_layer, text_layer_get_layer(date_layer));	// Init layer for battery image	battery_layer = bitmap_layer_create(frame);	bitmap_layer_set_background_color(battery_layer, GColorClear);	layer_set_frame(bitmap_layer_get_layer(battery_layer), GRect(4, 134, 30, 20));	layer_set_bounds(bitmap_layer_get_layer(battery_layer), GRect(0, 0, 30, 20));	bitmap_layer_set_bitmap(battery_layer, battery_outline);	layer_add_child(root_layer, bitmap_layer_get_layer(battery_layer));	// Init layer for charge image	charge_layer = bitmap_layer_create(frame);	bitmap_layer_set_background_color(charge_layer, GColorClear);	layer_set_frame(bitmap_layer_get_layer(charge_layer), GRect(8, 136, 20, 16));	layer_set_bounds(bitmap_layer_get_layer(charge_layer), GRect(0, 0, 20, 16));	bitmap_layer_set_bitmap(charge_layer, battery_charge);	layer_add_child(root_layer, bitmap_layer_get_layer(charge_layer));	// Init battery fill layer	battfill_layer = inverter_layer_create(frame);	layer_set_frame(inverter_layer_get_layer(battfill_layer), GRect(8, 136, 0, 16));	layer_add_child(root_layer, inverter_layer_get_layer(battfill_layer));	// Init layer for battery percentage	percent_layer = text_layer_create(frame);	layer_set_frame(text_layer_get_layer(percent_layer), GRect(4, 154, 30, 14));	layer_set_bounds(text_layer_get_layer(percent_layer), GRect(0, 0, 30, 14));	text_layer_set_text_alignment(percent_layer, GTextAlignmentCenter);	text_layer_set_font(percent_layer, font_tiny);	layer_add_child(root_layer, text_layer_get_layer(percent_layer));	battery_state_service_subscribe(set_battery);	set_battery(battery_state_service_peek());	show_battery();	tick_timer_service_subscribe(SECOND_UNIT, &handle_second_tick);}
开发者ID:ollien,项目名称:BitFace,代码行数:61,


示例8: handle_init

void handle_init(AppContextRef ctx) {  (void)ctx;  g_ctx = ctx;    window_init(&window, "Golf Dashboard");  window_stack_push(&window, true /* Animated */);    GFont defaultfont = fonts_get_system_font(FONT_KEY_GOTHIC_14);    layer_init(&holepar, GRect(0, 0, 144 /* width */, 40 /* height */));  holepar.update_proc = &holepar_layer_callback;  layer_add_child(&window.layer, &holepar);    text_layer_init(&holepar_hole, GRect(0, 0, 72, 17));  text_layer_set_background_color(&holepar_hole, GColorClear);  text_layer_set_text_color(&holepar_hole, GColorBlack);  text_layer_set_text(&holepar_hole, "Hole");  text_layer_set_text_alignment(&holepar_hole, GTextAlignmentCenter);  layer_add_child(&holepar, &holepar_hole.layer);    GFont holeparfont = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD);  text_layer_init(&holepar_hole_num, GRect(0, 10, 60, 30));  text_layer_set_background_color(&holepar_hole_num, GColorClear);  text_layer_set_text_color(&holepar_hole_num, GColorBlack);  text_layer_set_font(&holepar_hole_num,holeparfont);  text_layer_set_text(&holepar_hole_num, "");  text_layer_set_text_alignment(&holepar_hole_num, GTextAlignmentCenter);  layer_add_child(&holepar, &holepar_hole_num.layer);      text_layer_init(&holepar_par, GRect(72, 0, 72, 17));  text_layer_set_background_color(&holepar_par, GColorClear);  text_layer_set_text_color(&holepar_par, GColorBlack);  text_layer_set_text(&holepar_par, "Par");  text_layer_set_text_alignment(&holepar_par, GTextAlignmentCenter);  layer_add_child(&holepar, &holepar_par.layer);  //  GFont holeparfont = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD);  text_layer_init(&holepar_par_num, GRect(75, 10, 60, 30));  text_layer_set_background_color(&holepar_par_num, GColorClear);  text_layer_set_text_color(&holepar_par_num, GColorBlack);  text_layer_set_font(&holepar_par_num,holeparfont);  text_layer_set_text(&holepar_par_num, "0");  text_layer_set_text_alignment(&holepar_par_num, GTextAlignmentCenter);  layer_add_child(&holepar, &holepar_par_num.layer);    text_layer_init(&roundtime, GRect(0, 40, 144 /* width */, 15 /* height */));  text_layer_set_background_color(&roundtime, GColorBlack);  text_layer_set_text_color(&roundtime, GColorWhite);  text_layer_set_font(&roundtime, defaultfont);  text_layer_set_text(&roundtime, "Round Time:      ");  text_layer_set_text_alignment(&roundtime, GTextAlignmentCenter);  layer_add_child(&window.layer, &roundtime.layer);    GFont yrdfont = fonts_get_system_font(FONT_KEY_GOTHAM_42_MEDIUM_NUMBERS);  text_layer_init(&distance, GRect(0, 55, 144 /* width */, 50 /* height */));  text_layer_set_background_color(&distance, GColorBlack);  text_layer_set_text_color(&distance, GColorWhite);// Placeholder for Sports SDK  text_layer_set_text(&distance, "000");  text_layer_set_font(&distance, yrdfont);  text_layer_set_text_alignment(&distance, GTextAlignmentCenter);  layer_add_child(&window.layer, &distance.layer);     mini_snprintf(s_shots_hole, 25, "Shots: %d", thishole);  text_layer_init(&shots_hole, GRect(0, 105, 72 /* width */, 15 /* height */));  text_layer_set_background_color(&shots_hole, GColorBlack);  text_layer_set_text_color(&shots_hole, GColorWhite);  text_layer_set_font(&shots_hole, defaultfont);  text_layer_set_text(&shots_hole, s_shots_hole);  text_layer_set_text_alignment(&shots_hole, GTextAlignmentLeft);  layer_add_child(&window.layer, &shots_hole.layer);    mini_snprintf(s_shots_total, 25, "Total: %d", totalshots);  text_layer_init(&shots_total, GRect(72, 105, 72 /* width */, 15 /* height */));  text_layer_set_background_color(&shots_total, GColorBlack);  text_layer_set_text_color(&shots_total, GColorWhite);  text_layer_set_font(&shots_total, defaultfont);  text_layer_set_text(&shots_total, s_shots_total);  text_layer_set_text_alignment(&shots_total, GTextAlignmentRight);  layer_add_child(&window.layer, &shots_total.layer);    GFont clubfont = fonts_get_system_font(FONT_KEY_GOTHIC_24);  text_layer_init(&club, GRect(0, 120, 144 /* width */, 168-120-16 /* height */));  text_layer_set_background_color(&club, GColorWhite);  text_layer_set_text_color(&club, GColorBlack);  text_layer_set_font(&club, clubfont);  text_layer_set_text(&club, club_menu[club_menu_index]);  text_layer_set_text_alignment(&club, GTextAlignmentCenter);  layer_add_child(&window.layer, &club.layer);   window_set_click_config_provider(&window, (ClickConfigProvider) click_config_provider);  }
开发者ID:magic7s,项目名称:pebble_golfapp_poc,代码行数:94,


示例9: main_window_load

static void main_window_load(Window *window) {	//Create background bitmap, then set to created BitmapLayer  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_DEDSEC_LOGO);  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 BT bitmap, then set to created BitmapLayer  s_bluetooth_bitmap = gbitmap_create_with_resource(RESOURCE_ID_SIGNAL);  s_bluetooth_layer = bitmap_layer_create(GRect(0, 144, 20, 20));    bitmap_layer_set_bitmap(s_bluetooth_layer, s_bluetooth_bitmap);  layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_bluetooth_layer));		//Create Battery bitmap, then set to created BitmapLayer  s_battery_bitmap = gbitmap_create_with_resource(RESOURCE_ID_BATTERY_CHARGING);  s_battery_layer = bitmap_layer_create(GRect(122, 123, 22, 18));	bitmap_layer_set_bitmap(s_battery_layer, s_battery_bitmap);  layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_battery_layer));			// Create time TextLayer  s_hour_layer = text_layer_create(GRect(0, -5, 60, 84));  text_layer_set_background_color(s_hour_layer, GColorClear);  text_layer_set_text_color(s_hour_layer, GColorWhite);  text_layer_set_text(s_hour_layer, "00");  s_minute_layer = text_layer_create(GRect(0, 55, 60, 84));  text_layer_set_background_color(s_minute_layer, GColorClear);  text_layer_set_text_color(s_minute_layer, GColorWhite);  text_layer_set_text(s_minute_layer, "00");    	//Create GFont  	s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_WATCHDOGS_SUBSET_58));  	//Apply to TextLayer  	text_layer_set_font(s_hour_layer, s_time_font);  	text_layer_set_text_alignment(s_hour_layer, GTextAlignmentCenter);		  text_layer_set_font(s_minute_layer, s_time_font);  	text_layer_set_text_alignment(s_minute_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_hour_layer));	  layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_minute_layer));		//Create date text layer	s_date_layer = text_layer_create(GRect(0, 150, 144, 18));  text_layer_set_background_color(s_date_layer, GColorClear);  text_layer_set_text_color(s_date_layer, GColorWhite);  text_layer_set_text(s_date_layer, "MON_01_01_2001");	text_layer_set_text_alignment(s_date_layer, GTextAlignmentRight);	text_layer_set_font(s_date_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_date_layer));    		//Create connection background layer	s_connection_bg_layer = text_layer_create(GRect(0, 123, 122, 18));		#ifdef PBL_COLOR	  text_layer_set_background_color(s_connection_bg_layer, GColorTiffanyBlue);	#else	  text_layer_set_background_color(s_connection_bg_layer, GColorClear);	#endif  text_layer_set_text_color(s_connection_bg_layer, GColorWhite);  text_layer_set_text(s_connection_bg_layer, CONNECTION_TEXT);	text_layer_set_font(s_connection_bg_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_connection_bg_layer));		//Create connection text layer	s_connection_layer = text_layer_create(GRect(0, 123, 122, 18));  text_layer_set_text(s_connection_layer, CONNECTION_TEXT);  s_connection_bar_color = GColorWhite;  layer_set_update_proc((Layer*) s_connection_layer, text_update_proc);	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_connection_layer));		//Create hacking text layer	s_hacking_layer = text_layer_create(GRect(0, 137, 144, 18));  text_layer_set_background_color(s_hacking_layer, GColorClear);  text_layer_set_text_color(s_hacking_layer, GColorWhite);  text_layer_set_text(s_hacking_layer, "_hacking is our weapon");	text_layer_set_text_alignment(s_hacking_layer, GTextAlignmentRight);		text_layer_set_font(s_hacking_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));	layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_hacking_layer));		// Make sure the time is displayed from the start  update_time();		// Show current connection state  bt_handler(bluetooth_connection_service_peek());		// Show current battery state  battery_handler(battery_state_service_peek());}
开发者ID:bls220,项目名称:dedsec-watchface,代码行数:90,


示例10: main_window_load

static void main_window_load(Window *window) {    window_set_background_color(s_my_window, GColorBlack);  tick_timer_service_subscribe(MINUTE_UNIT, tick_handler);  bluetooth_connection_service_subscribe(bluetooth_handler);  s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_LIGHT_72));  s_minute_layer = text_layer_create(GRect(15, 56, 144, 80));  text_layer_set_text(s_minute_layer, "");  text_layer_set_text_alignment(s_minute_layer, GTextAlignmentCenter);  text_layer_set_font(s_minute_layer, s_time_font);  text_layer_set_background_color(s_minute_layer, GColorClear);  s_hour_layer = text_layer_create(GRect(-23, 19, 154, 61));  text_layer_set_font(s_hour_layer, s_time_font);  text_layer_set_text(s_hour_layer, "");  text_layer_set_text_alignment(s_hour_layer, GTextAlignmentCenter);  text_layer_set_background_color(s_hour_layer, GColorBlack);    date_layer = text_layer_create(GRect(0, 0, 144, 20));  text_layer_set_font(date_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18));  text_layer_set_text_alignment(date_layer, GTextAlignmentCenter);  text_layer_set_background_color(date_layer, GColorBlack);  text_layer_set_text_color(date_layer, GColorWhite);   s_line_layer = layer_create(GRect(0 , 0, 144, 168));  layer_set_update_proc(s_line_layer, s_layer_update_proc);    #ifdef PBL_BW  s_inv_layer = inverter_layer_create(GRect(0, 0, 144, 168));    text_layer_set_text_color(s_minute_layer , GColorWhite);    text_layer_set_text_color(s_hour_layer , GColorWhite);  #else     text_layer_set_text_color(s_minute_layer , GColorSpringBud);    text_layer_set_text_color(s_hour_layer , GColorGreen);        #endif            layer_add_child(window_get_root_layer(s_my_window), text_layer_get_layer(s_minute_layer));  layer_add_child(window_get_root_layer(s_my_window), text_layer_get_layer(s_hour_layer));  layer_add_child(window_get_root_layer(s_my_window), s_line_layer);  layer_add_child(window_get_root_layer(s_my_window), text_layer_get_layer(date_layer));  #ifdef PBL_BW  layer_add_child(window_get_root_layer(window), inverter_layer_get_layer(s_inv_layer));  #endif           if(persist_exists(KEY_INVERT_FACE)){      invert_face = persist_read_int(KEY_INVERT_FACE);    APP_LOG(APP_LOG_LEVEL_INFO, "Read Invert");    }     if(persist_exists(KEY_BLUETOOTH_VIBRATION)){    bluetooth_vibration = persist_read_int(KEY_BLUETOOTH_VIBRATION);    APP_LOG(APP_LOG_LEVEL_INFO,"Bluetooth read");   }  if(persist_exists(KEY_SHOW_DATE)){    show_date = persist_read_int(KEY_SHOW_DATE);    APP_LOG(APP_LOG_LEVEL_INFO, "Read Date");  }      update_time();update_layers();      struct tm *t;  time_t temp;  temp = time(NULL);  t = localtime(&temp);    tick_handler(t, MINUTE_UNIT);       }
开发者ID:turnervink,项目名称:CUTOFF,代码行数:81,


示例11: window_load

static void window_load(Window *window) {	Layer *window_layer = window_get_root_layer(window);	GRect bounds = layer_get_bounds(window_layer);		int offset = !b_show_numbers * 10;	s_simple_bg_layer = layer_create(bounds);	layer_set_update_proc(s_simple_bg_layer, bg_update_proc);	layer_add_child(window_layer, s_simple_bg_layer);	window_set_background_color(window, gcolor_background);#ifdef PBL_RECT  date_layer_right = text_layer_create(GRect(    (bounds.size.w - DATE_LAYER_HORIZONTAL_OFFSET),    (bounds.size.h/2 - DATE_LAYER_VERTICAL_OFFSET),     DATE_LAYER_HORIZONTAL_OFFSET,    60));  date_layer_left = text_layer_create(GRect(    0,    (bounds.size.h/2 - DATE_LAYER_VERTICAL_OFFSET),    DATE_LAYER_HORIZONTAL_OFFSET + offset,    60));    date_layer_bottom = text_layer_create(GRect(    0,    (bounds.size.h - DATE_LAYER_BOTTOM_OFFSET),    bounds.size.w,    DATE_LAYER_BOTTOM_OFFSET));#else  date_layer_right = text_layer_create(GRect(    (bounds.size.w - DATE_LAYER_HORIZONTAL_OFFSET),    (bounds.size.h/2 - DATE_LAYER_VERTICAL_OFFSET),     DATE_LAYER_HORIZONTAL_OFFSET,    60));  date_layer_left = text_layer_create(GRect(    0,    (bounds.size.h/2 - DATE_LAYER_VERTICAL_OFFSET),    DATE_LAYER_HORIZONTAL_OFFSET + (offset * 4),    60));    date_layer_bottom = text_layer_create(GRect(    0,    (bounds.size.h - DATE_LAYER_BOTTOM_OFFSET),    bounds.size.w,    DATE_LAYER_BOTTOM_OFFSET + (offset * 2))); #endif   text_layer_set_background_color(date_layer_right, GColorClear);  text_layer_set_text_color(date_layer_right, gcolor_numbers);  text_layer_set_text_alignment(date_layer_right, GTextAlignmentCenter);  text_layer_set_font(date_layer_right, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));    text_layer_set_background_color(date_layer_left, GColorClear);  text_layer_set_text_color(date_layer_left, gcolor_numbers);  text_layer_set_text_alignment(date_layer_left, GTextAlignmentCenter);  text_layer_set_font(date_layer_left, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));    text_layer_set_background_color(date_layer_bottom, GColorClear);  text_layer_set_text_color(date_layer_bottom, gcolor_numbers);  text_layer_set_text_alignment(date_layer_bottom, GTextAlignmentCenter);  text_layer_set_font(date_layer_bottom, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); update_date(); layer_add_child(window_layer, text_layer_get_layer(date_layer_right));  layer_add_child(window_layer, text_layer_get_layer(date_layer_left));  layer_add_child(window_layer, text_layer_get_layer(date_layer_bottom));	s_hands_layer = layer_create(bounds);	layer_set_update_proc(s_hands_layer, hands_update_proc);	layer_add_child(window_layer, s_hands_layer);	load_persisted_values();}
开发者ID:bwssytems,项目名称:Engineering2,代码行数:74,


示例12: handle_init

void handle_init(AppContextRef ctx) {  (void)ctx;	  window_init(&window, "KP Sun-Moon-Clock");  window_stack_push(&window, true /* Animated */);  window_set_background_color(&window, GColorWhite);  resource_init_current_app(&APP_RESOURCES);  font_moon = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_MOON_PHASES_SUBSET_30));  layer_init(&graphics_sun_layer, window.layer.frame);  graphics_sun_layer.update_proc = &graphics_sun_layer_update_callback;  layer_add_child(&window.layer, &graphics_sun_layer);  rotbmp_pair_init_container(RESOURCE_ID_IMAGE_WATCHFACE_WHITE, RESOURCE_ID_IMAGE_WATCHFACE_BLACK, &watchface_container);  layer_add_child(&graphics_sun_layer, &watchface_container.layer.layer);  rotbmp_pair_layer_set_angle(&watchface_container.layer, 1);  watchface_container.layer.layer.frame.origin.x = (144/2) - (watchface_container.layer.layer.frame.size.w/2);  watchface_container.layer.layer.frame.origin.y = (168/2) - (watchface_container.layer.layer.frame.size.h/2);  text_layer_init(&text_time_layer, window.layer.frame);  text_layer_set_text_color(&text_time_layer, GColorBlack);  text_layer_set_background_color(&text_time_layer, GColorClear);  layer_set_frame(&text_time_layer.layer, GRect(0, 35, 144, 30));  text_layer_set_font(&text_time_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_30)));  layer_add_child(&window.layer, &text_time_layer.layer);  rotbmp_pair_init_container(RESOURCE_ID_IMAGE_HOUR_WHITE, RESOURCE_ID_IMAGE_HOUR_BLACK, &bitmap_container);  rotbmp_pair_layer_set_src_ic(&bitmap_container.layer, GPoint(9,56));  layer_add_child(&window.layer, &bitmap_container.layer.layer);  text_layer_init(&moonLayer, GRect(0, 100, 144 /* width */, 168-115 /* height */));  text_layer_set_text_color(&moonLayer, GColorWhite);  text_layer_set_background_color(&moonLayer, GColorClear);  text_layer_set_font(&moonLayer, font_moon);  text_layer_set_text_alignment(&moonLayer, GTextAlignmentCenter);  handle_day(ctx, NULL);	  layer_add_child(&window.layer, &moonLayer.layer);	PblTm t;  get_time(&t);  rotbmp_pair_layer_set_angle(&bitmap_container.layer, TRIG_MAX_ANGLE * get24HourAngle(t.tm_hour, t.tm_min));  bitmap_container.layer.layer.frame.origin.x = (144/2) - (bitmap_container.layer.layer.frame.size.w/2);  bitmap_container.layer.layer.frame.origin.y = (168/2) - (bitmap_container.layer.layer.frame.size.h/2);  //Day of Week text  text_layer_init(&dow_layer, GRect(0, 0, 144, 127+26));  text_layer_set_text_color(&dow_layer, GColorWhite);  text_layer_set_background_color(&dow_layer, GColorClear);  text_layer_set_font(&dow_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD));  text_layer_set_text_alignment(&dow_layer, GTextAlignmentLeft);  text_layer_set_text(&dow_layer, "xxx");  layer_add_child(&window.layer, &dow_layer.layer);  //Day of the Month text  text_layer_init(&dom_layer, GRect(0, 10, 144, 137+26));  text_layer_set_text_color(&dom_layer, GColorWhite);  text_layer_set_background_color(&dom_layer, GColorClear);  text_layer_set_font(&dom_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));  text_layer_set_text_alignment(&dom_layer, GTextAlignmentLeft);  text_layer_set_text(&dom_layer, "00");  layer_add_child(&window.layer, &dom_layer.layer);	  //Month Text  text_layer_init(&mon_layer, GRect(0, 0, 144, 127+26));  text_layer_set_text_color(&mon_layer, GColorWhite);  text_layer_set_background_color(&mon_layer, GColorClear);  text_layer_set_font(&mon_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD));  text_layer_set_text_alignment(&mon_layer, GTextAlignmentRight);  text_layer_set_text(&mon_layer, "xxx");  layer_add_child(&window.layer, &mon_layer.layer);  //Year Number text  text_layer_init(&yon_layer, GRect(0, 10, 144, 137+26));  text_layer_set_text_color(&yon_layer, GColorWhite);  text_layer_set_background_color(&yon_layer, GColorClear);  text_layer_set_font(&yon_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));  text_layer_set_text_alignment(&yon_layer, GTextAlignmentRight);  text_layer_set_text(&yon_layer, "00");  layer_add_child(&window.layer, &yon_layer.layer); 	  //Sunrise Text   text_layer_init(&text_sunrise_layer, window.layer.frame);  text_layer_set_text_color(&text_sunrise_layer, GColorWhite);  text_layer_set_background_color(&text_sunrise_layer, GColorClear);  layer_set_frame(&text_sunrise_layer.layer, GRect(0, 145, 144, 30));  text_layer_set_font(&text_sunrise_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18));  layer_add_child(&window.layer, &text_sunrise_layer.layer); //Sunset Text  text_layer_init(&text_sunset_layer, window.layer.frame);  text_layer_set_text_color(&text_sunset_layer, GColorWhite);  text_layer_set_background_color(&text_sunset_layer, GColorClear);  layer_set_frame(&text_sunset_layer.layer, GRect(0, 145, 144, 30));  text_layer_set_font(&text_sunset_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18));  layer_add_child(&window.layer, &text_sunset_layer.layer);   http_set_app_id(55122370);//.........这里部分代码省略.........
开发者ID:antgiant,项目名称:KP_Sun_Moon_Vibe_Clock,代码行数:101,


示例13: show_text

static void show_text(char *message, GColor fg_color, GColor bg_color) {  text_layer_set_text_color(s_output_layer, fg_color);  text_layer_set_background_color(s_output_layer, bg_color);  text_layer_set_font(s_output_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));  text_layer_set_text(s_output_layer, message);}
开发者ID:bahbka,项目名称:pebble-talk2web,代码行数:6,


示例14: handle_init

void handle_init(void) {    my_window = window_create();    window_set_background_color(my_window, GColorBlack);    line_layer = layer_create(GRect(0, 0, 144, 168));    layer_set_update_proc(line_layer, draw_line);    time_layer = text_layer_create(GRect(90, 20, 144, 32));    text_layer_set_background_color(time_layer, GColorBlack);#if defined(PBL_ROUND)    text_done = text_layer_create(GRect(33,99,144,48));    text_get = text_layer_create(GRect(33, 44, 144, 32));    text_shit = text_layer_create(GRect(33,74,144,32));    text_emoji = text_layer_create(GRect(15,44,50,50));#elif defined(PBL_RECT)    text_done = text_layer_create(GRect(22,95,144,48));    text_get = text_layer_create(GRect(22, 40, 144, 32));    text_shit = text_layer_create(GRect(22,70,144,32));    text_emoji = text_layer_create(GRect(2,40,50,50));#endif    text_layer_set_background_color(text_emoji, GColorBlack);    text_layer_set_text_color(text_emoji, GColorWhite);    text_layer_set_text(text_emoji, "/U0001F603");    s_custom_font_bold = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_ROBOTO_BOLD_48));    text_layer_set_font(text_done, s_custom_font_bold);    text_layer_set_background_color(text_done, GColorBlack);#if defined(PBL_COLOR)    text_layer_set_text_color(text_done, GColorRed);    text_layer_set_text(text_done, "DONE.");#elif defined(PBL_BW)    text_layer_set_text_color(text_done, GColorWhite);    text_layer_set_text(text_done, "DONE.");#endif    s_custom_font_24 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_ROBOTO_32));    text_layer_set_font(text_get, s_custom_font_24);    text_layer_set_background_color(text_get, GColorBlack);    text_layer_set_text_color(text_get, GColorWhite);    text_layer_set_text(text_get, "Get");    text_layer_set_font(text_shit, s_custom_font_24);    text_layer_set_background_color(text_shit, GColorBlack);    text_layer_set_text_color(text_shit, GColorWhite);    text_layer_set_text(text_shit, "Shit");    s_custom_font_bold = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_ROBOTO_18));    text_layer_set_font(time_layer, s_custom_font_bold);    text_layer_set_text_color(time_layer, GColorWhite);    text_layer_set_text(time_layer, "00:00");    //draw_line(ctx);    layer_add_child(window_get_root_layer(my_window), text_layer_get_layer(text_done));    layer_add_child(window_get_root_layer(my_window), text_layer_get_layer(text_emoji));    layer_add_child(window_get_root_layer(my_window), text_layer_get_layer(text_shit));    layer_add_child(window_get_root_layer(my_window), text_layer_get_layer(text_get));    layer_add_child(window_get_root_layer(my_window), text_layer_get_layer(time_layer));    layer_add_child(window_get_root_layer(my_window), line_layer);    window_stack_push(my_window, true);    tick_timer_service_subscribe(MINUTE_UNIT, tick_handler);}
开发者ID:volco,项目名称:getitdone,代码行数:65,


示例15: handle_init

void handle_init(AppContextRef ctx) {  (void)ctx;  window_init(&window, "Modern Watch");  window_stack_push(&window, true /* Animated */);  resource_init_current_app(&APP_RESOURCES);#if DISPLAY_LOGO && DISPLAY_DATE_ANALOG  bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND_LOGO_DATEBOX, &background_image_container);#elif DISPLAY_LOGO  bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND_LOGO, &background_image_container);#elif DISPLAY_DATE_ANALOG  bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND_DATEBOX, &background_image_container);#else  bmp_init_container(RESOURCE_ID_IMAGE_BACKGROUND, &background_image_container);#endif  layer_add_child(&window.layer, &background_image_container.layer.layer);#if DISPLAY_DATE_ANALOG  date_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ORBITRON_MEDIUM_12));  text_layer_init(&date_layer, GRect(116, 77, 20, 20));  text_layer_set_text_color(&date_layer, GColorBlack);#elif DISPLAY_DATE_DIGITAL || DISPLAY_DATE_DIGITAL_DAY  date_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_DIGITALDREAM_NARROW_12));  text_layer_init(&date_layer, GRect(27, 40, 90, 30));  text_layer_set_text_color(&date_layer, GColorWhite);#endif#if DISPLAY_DATE_ANALOG || DISPLAY_DATE_DIGITAL || DISPLAY_DATE_DIGITAL_DAY  text_layer_set_text_alignment(&date_layer, GTextAlignmentCenter);  text_layer_set_background_color(&date_layer, GColorClear);  text_layer_set_font(&date_layer, date_font);  layer_add_child(&window.layer, &date_layer.layer);  draw_date();#endif  layer_init(&hour_display_layer, window.layer.frame);  hour_display_layer.update_proc = &hour_display_layer_update_callback;  layer_add_child(&window.layer, &hour_display_layer);  gpath_init(&hour_hand_outline_path, &HOUR_HAND_OUTLINE_PATH_POINTS);  gpath_move_to(&hour_hand_outline_path, grect_center_point(&hour_display_layer.frame));  gpath_init(&hour_hand_path, &HOUR_HAND_PATH_POINTS);  gpath_move_to(&hour_hand_path, grect_center_point(&hour_display_layer.frame));  layer_init(&minute_display_layer, window.layer.frame);  minute_display_layer.update_proc = &minute_display_layer_update_callback;  layer_add_child(&window.layer, &minute_display_layer);  gpath_init(&minute_hand_outline_path, &MINUTE_HAND_OUTLINE_PATH_POINTS);  gpath_move_to(&minute_hand_outline_path, grect_center_point(&minute_display_layer.frame));  gpath_init(&minute_hand_path, &MINUTE_HAND_PATH_POINTS);  gpath_move_to(&minute_hand_path, grect_center_point(&minute_display_layer.frame));  layer_init(&center_display_layer, window.layer.frame);  center_display_layer.update_proc = &center_display_layer_update_callback;  layer_add_child(&window.layer, &center_display_layer);#if DISPLAY_SECONDS  layer_init(&second_display_layer, window.layer.frame);  second_display_layer.update_proc = &second_display_layer_update_callback;  layer_add_child(&window.layer, &second_display_layer);#endif}
开发者ID:7bp,项目名称:pebble,代码行数:62,


示例16: main_window_load

static void main_window_load(Window *window) {    // Get information about the window needed for drawing text 'n shit    Layer *window_layer = window_get_root_layer(window);    GRect bounds = layer_get_bounds(window_layer);    /* Bitmap layer for displaying the background */    // Create GBitmap    s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BACKGROUND);    // Create BitmapLayer to display the GBitmap    s_background_layer = bitmap_layer_create(bounds);    // Add bitmap to the layer and add the layer to the window as a child    bitmap_layer_set_bitmap(s_background_layer, s_background_bitmap);    layer_add_child(window_layer, bitmap_layer_get_layer(s_background_layer));    /* Text layer for displaying the time */    // Create TextLayer    s_time_layer = text_layer_create(        GRect(0, 53, bounds.size.w, 50));    // Set layout options    text_layer_set_background_color(s_time_layer, GColorRed);    text_layer_set_text_color(s_time_layer, GColorYellow);    text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_LECO_42_NUMBERS));    text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);    // Add child    layer_add_child(window_layer, text_layer_get_layer(s_time_layer));    /* Text layer for displaying the current date */    // Create TextLayer    s_date_layer = text_layer_create(GRect(-10, 105, bounds.size.w, 20));    // Set layout options    text_layer_set_background_color(s_date_layer, GColorRed);    text_layer_set_text_color(s_date_layer, GColorYellow);    text_layer_set_font(s_date_layer, fonts_get_system_font(FONT_KEY_LECO_20_BOLD_NUMBERS));    text_layer_set_text_alignment(s_date_layer, GTextAlignmentRight);    // Add child    layer_add_child(window_layer, text_layer_get_layer(s_date_layer));    /* Text Layer for displaying battery info */    // Create TextLayer    s_battery_info_layer = text_layer_create(GRect(-10, 10, bounds.size.w, 20));    // Set layout options    text_layer_set_background_color(s_battery_info_layer, GColorRed);    text_layer_set_text_color(s_battery_info_layer, GColorYellow);    text_layer_set_font(s_battery_info_layer, fonts_get_system_font(FONT_KEY_LECO_20_BOLD_NUMBERS));    text_layer_set_text_alignment(s_battery_info_layer, GTextAlignmentRight);    // Add child    layer_add_child(window_layer, text_layer_get_layer(s_battery_info_layer));    // Get first value    BatteryChargeState charge = battery_state_service_peek();    static char charge_percent_char[] = "00000000000";    snprintf(charge_percent_char, sizeof(charge_percent_char), "%d", charge.charge_percent);    text_layer_set_text(s_battery_info_layer, charge_percent_char);    /* Text Layer for displaying steps counted by Pebble Health */    // Create TextLayer    s_step_count_layer = text_layer_create(GRect(-10, 30, bounds.size.w, 20));    // Set layout options    text_layer_set_background_color(s_step_count_layer, GColorRed);    text_layer_set_text_color(s_step_count_layer, GColorYellow);    text_layer_set_font(s_step_count_layer, fonts_get_system_font(FONT_KEY_LECO_20_BOLD_NUMBERS));    text_layer_set_text_alignment(s_step_count_layer, GTextAlignmentRight);    // Add child    layer_add_child(window_layer, text_layer_get_layer(s_step_count_layer));    // Get first value    update_step_counter();}
开发者ID:Tijndagamer,项目名称:Pebble-Watchface,代码行数:83,


示例17: main_window_load

static void main_window_load(Window *window) {	Layer *window_layer = window_get_root_layer(window);	GRect bounds = layer_get_frame(window_layer);	// 
C++ text_layer_set_text_alignment函数代码示例
C++ text_layer_init函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。